Display answer
22 ビュー (過去 30 日間)
古いコメントを表示
Suppose i have three part in a program. I can see three display at a time when i run the program.
If I want to see the result individually, what I have to do (without blocking semicolon or keeping % before display or fprintf command)?
suppose,
a=5; disp(5) b=6; disp(b) c=55; disp(c)
I want to see only the result of b Pls help me somebody
0 件のコメント
回答 (2 件)
Walter Roberson
2011 年 4 月 5 日
evalc() the program and use text processing techniques to locate the display of "b" and print it out.
2 件のコメント
Walter Roberson
2011 年 4 月 5 日
t = textscan(evalc(sprintf('%s\n', '%%', 'a=5; disp(5)', '%%', 'b=6; disp(b)', '%%', 'c=55; disp(c)')),'%s');
The b part is then
t{1}{2}
However, considering you have put the %% there, possibly the answer you are really looking for is this:
Click on the part you want executed. Right-click and select "execute cell"
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!