translating from idl to matlab

1 Ansicht (letzte 30 Tage)
hasan alhussaini
hasan alhussaini am 25 Aug. 2017
Beantwortet: Michelle Wu am 28 Aug. 2017
Hi I'm trying to translate some codes i have from IDL to matlab.
the idl codes are
lineflat = reform(flatsub(*,cutline))
this is my understanding in matlab
lineflat = reshape(flatsub,cutline,:);
however i get an error that ":" that tells me "Undefined function or variable 'reshape'"
if i change the : to [] it works? but im not sure if its the same function flatsub is a variable, and cutline is a number.
Thanks

Antworten (1)

Michelle Wu
Michelle Wu am 28 Aug. 2017
If you are trying to call the MATLAB built-in function 'reshape', you need to follow the correct syntax in order for it to work. As can be seen from the ' reshape ' documentation, you can specify a single dimension size of '[]' to have the dimension size automatically calculated. On the other hand, ':' is not a valid input for the 'reshape' function.

Kategorien

Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by