Run one line or the other Option
조회 수: 3 (최근 30일)
이전 댓글 표시
I have a code in which I need two options. Either user wants to give message at runtime or want to read from a file.
message = fileread('message.txt');
%OR
message = input('Enter your message to embedd: ', 's');
How can I get prompt message in Matlab, either to select a file or enter your message?
댓글 수: 0
채택된 답변
madhan ravi
2019년 7월 19일
Certainy not sure what you want to do but see if https://in.mathworks.com/help/matlab/ref/msgbox.html does what you want.
댓글 수: 3
madhan ravi
2019년 7월 19일
According to what I understand:
Inp = input('Press 1 or 0');
if ~Inp % if Inp is 0
message = fileread('sample.txt');
else
message = input('Enter your message to embedd: ', 's');
end
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!