new to matlab simple question
1 次查看(过去 30 天)
显示 更早的评论
when you do a computation ie c=(b+a)/2 will this automatically display in matlab? i'm new to MATLAB but not programming at all and was just wondering if there is a display command or if all calculations are displayed which would make most sense to me since MATLAB is just math calculations...
0 个评论
采纳的回答
bio lim
2016-11-28
编辑:bio lim
2016-11-28
Yes it will, assuming that you have previously defined the values for a,b,c obviously.
If you write semicolon at the end of your c=(b+a)/2; then it won't display.
2 个评论
bio lim
2016-11-28
Yes, all of them will display their outputs on new lines. If I run your above program with (in this case it won't give any outputs since we ended it with semicolons):
a = 1;
b = 2;
My output in command window is:
ans =
1.8147
c =
1.5000
ans =
0.0833
Also, if you don't define a variable when you are doing an operation, e.g., ((b-a)^2)/12, MATLAB names the output ans.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!