Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Why do I have 2 outputs instead of 1

4 visualizaciones (últimos 30 días)
Afif Ben Fekih
Afif Ben Fekih el 10 de Ag. de 2018
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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 comentario
Stephen23
Stephen23 el 10 de Ag. de 2018
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.

Respuestas (1)

James Tursa
James Tursa el 10 de Ag. de 2018
Editada: James Tursa el 10 de Ag. de 2018
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 comentario
Afif Ben Fekih
Afif Ben Fekih el 10 de Ag. de 2018
Thank you, I've just noticed the problem, I've been using Matlab for a long time now, probably I need to take a little break. Greetings :)

La pregunta está cerrada.

Productos


Versión

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by