why does matlab store variables in workspace in engineering notation?

조회 수: 2 (최근 30일)
This is VERY annoying when you want to something simple like
simulationtime=max(y);
sim('model.mdl')
and you get an error: Invalid StopTime specified in the Configuration Parameters dialog for block diagram
because your simulation time is 6600
and matlab stores it in the workspace as 6.000e+03 !!!!!
Rajesh
  댓글 수: 2
per isakson
per isakson 2012년 10월 10일
Distinguish between store and display
Rajesh
Rajesh 2012년 10월 10일
i dont mean display. for display i know i can use format to change the way it displays on the command window.
i mean store: how it is seen as stored in the workspace. when you click on simulationtime in the workspace you see it as 6.5e+03

댓글을 달려면 로그인하십시오.

채택된 답변

Rajesh
Rajesh 2012년 10월 10일
try 6508.79?
anyway for now i got around it by doing this:
simulationtime= double(max(y));
i dont know why simulink needs time to be in double data type. but seems it is how it is!
  댓글 수: 1
Maddila
Maddila 2012년 12월 7일
but am not getting this,,,,i specified my variable value as double also,,,but not working outm,,,can you help me how to set stop time of simulation with incremmenting

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Daniel Shub
Daniel Shub 2012년 10월 10일
It seems very odd that MATLAB would display 6600 as 6.000e+03. I am also not able to get MATLAB to display 6.000e+03 (maybe it is a Windows/Linux difference). That said, have you looked at format?
doc format
If you set the format to be long, maybe you will get what you want. Consider
format short
x = 60000.1
x =
6.0000e+04
versus
format long
x = 60000.1
x =
6.000010000000000e+04

Walter Roberson
Walter Roberson 2012년 10월 13일
The workspace has its own format control.
MATLAB (and Simulink) do not store data in decimal notation (except for Symbolic Toolbox, and sometimes Fixed Point Toolbox): they use binary, and in particular IEEE 754 double precision (usually) or single precision. Any representation similar to 6.5e+03 is a result of converting the binary storage mechanisms to decimal notation.

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT Files에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by