Info
此问题已关闭。 请重新打开它进行编辑或回答。
Why do I have 2 outputs instead of 1
4 次查看(过去 30 天)
显示 更早的评论
Hello, I have a problem with the outputs. Instead of one output I have two. Exemple:
>> 0,1
ans =
0
ans =
1
Thank you for your help
1 个评论
Stephen23
2018-8-10
Because you are writing a comma-separated list, where the comma separates each item in the list. In MATLAB the comma always has the function as a list separator, it is not used for the decimal radix character.
回答(1 个)
James Tursa
2018-8-10
编辑:James Tursa
2018-8-10
The comma in MATLAB is a separator (i.e. forms a "comma-separated-list"), not a decimal point. So typing in 0,1 is equivalent to typing in 0, pressing Enter, then typing in 1 and pressing Enter. Use a period for the decimal point. E.g.,
>> 0,1
ans =
0
ans =
1
>> 0.1
ans =
0.1000
1 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!