Use the Programming Language ---- > MATLAB <--- A mumplication problem is provid
ID: 2084971 • Letter: U
Question
Use the Programming Language ---- > MATLAB <---
A mumplication problem is providea as a string using tne ormat x |mes y. Extractine murupicanx and mumpiler y rom inputString, and then assign multResult with the product. Ex: If inputString is '4 times 3', then multResult is 4 3, or 12. Your Function Save Reset MATLAB Documentation TimesTable (inputstring) 1 function multResult 2 multResult 0 end Code to call your function C Reset TimesTable('4 times 3 Run Function Assessments Tests Submit Check if TimesTable(' Check if TimesTable' 4 times 3) returns 12 Check if TimesTahlel'12 times 7' return 84Explanation / Answer
Function :
function multResult = TimesTable(inputString)
multResult = 0;
m_value = sscanf(inputString,'%d Times')
multResult = m_value(1)*m_value(2);
end
Code:
clc
clear all
close all
rslt = TimesTable('4 Times 3')
Output:
m_value =
4
3
rslt =
12
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.