How is it possible to get a different result in the MatLab command window as compared to a stand alone application
Mostrar comentarios más antiguos
I am calculating some basic attributes of coils. The first and easiest example is area. I know the length and width of a piece of steel. When I compute this in the MatLab command window I see my answer either by stopping on that line of code or by not using the ; at the end of the line doing the calculation.
Once I compile my code and process the same steel strip, I get 0.0 as my answer!
function UnitCoilSumm(coilName,coilType)
I initialize the array (a 1x1) in the beginning of my code:
coilArea = zeros(1,1);
I calculate the value:
coilArea = coilLength * stripWidthSpec; %length in meters, width in meters for metric
I then store or want to see my value:
csvRecord(109) = coilArea(1,1); %round(coilArea); %csvRecord(109)
coilArea(1,1)
end%funtion
How can I get help with this?
Bob Jones
Respuestas (2)
Walter Roberson
el 14 de Nov. de 2012
1 voto
This can happen in cases where variables are "poofed" into existence, and I suspect it can happen if the datatype of a variable is magically changed.
In your routines, do you call upon any scripts (not functions)?
When you wrote your code, did you insert an "end" to match each "function"? Doing so would result in interactive MATLAB more closely matching the behavior of compiled code.
3 comentarios
Robert Jones
el 14 de Nov. de 2012
Walter Roberson
el 14 de Nov. de 2012
Editada: Walter Roberson
el 14 de Nov. de 2012
The .mat file probably won't help, but the source to the full function might. Also, please indicate class() of any variable being load()'d or passed in.
Ah, one thing to check: are you aware that input arguments to the main routine of an executable are always received as strings? So the 2 would have to be str2double() to make it the numeric value 2 rather than the string '2' (numeric value 50) ?
Robert Jones
el 14 de Nov. de 2012
Robert Jones
el 14 de Nov. de 2012
0 votos
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!