Matlab function
3 次查看(过去 30 天)
显示 更早的评论
I'm relatively new to Matlab
I need to carry out the following task and I'm just partially done.I'd be happy if someone can help me as stated;
Task I'm doing is;
1) I have 2 functions A and B 2)Function A does some calculations. 3)After doing those calculations function A calls B- no arguments given to B 4)At this point Function B should prompt the user for some inputs 5)The user should enter the inputs through the coommand window 6)The user inputs are returned from function B to function A
Can anyone please advice how to carry out steps 4,5,6? Please help.
shalini
2 个评论
Andrew Newell
2012-3-7
See http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer.
回答(1 个)
Image Analyst
2012-3-7
There is a function called input(). Try that.
From its help:
reply = input('Do you want more? Y/N [Y]: ', 's');
if isempty(reply)
reply = 'Y';
end
6 个评论
Image Analyst
2012-3-7
Stangely, no. You have to do it like this:
% Ask user for several numbers, b
string_b = input('Enter the several numbers ', 's')
double_b = str2num(string_b)
% Multiply the two.
c = a * double_b
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!