Write a MATLAB script (maksimin) that calculates the maximum and minimum values in an input vector. You should consider that the input vector can have any length
1 次查看(过去 30 天)
显示 更早的评论
Write a MATLAB script (maksimin) that calculates the maximum and minimum values in an input vector. You should consider that the input vector can have any length. Please write the answer within a sentence.
i couldnt know how i can create a script which answer should give a sentences like that 'The maximum value is a and the minimum value is b'
0 个评论
采纳的回答
John D'Errico
2021-12-18
Do you know how to work with character strings, how to build them from components? You should. TRY IT! For example,
A = 'Fred';
B = 'Ethel';
disp([A,' and ',B])
Next, do you know how to convert a numeric variable into a string?
X = pi/2;
disp(['X has value ',num2str(X)])
6 个评论
John D'Errico
2021-12-19
disp works fine. Or you can use fprintf. You might add a space aroun the 'and'.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 String Parsing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!