Either in a script or in the Command Window, create a string variable that stores a string in which numbers are separated by the character ‘x’, for example '12x3x45x2'
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:7| Question number:28.7
All Answers
total answers (1)
>> str = '12x3x45x2';
>> vec = str2num(strrep(str,'x',' '));
>> sum(vec)
ans =
62
need an explanation for this answer? contact us directly to get an explanation for this answer