"To RESHAPE the number of elements must not change" error during plot
Mostrar comentarios más antiguos
Dear all,
I have a function (1x1 symfun) S4(t) with a variable of t. It's a very very long expression so I cannot write them here but it is a multi-exponential function.
Then I did:
t = 0:0.0000001:0.00002
y = S4(t)
plot(t,y)
However, I got "To RESHAPE the number of elements must not change". I have no idea where this came from because I have never used the command RESHAPE. Also, the first time around, when S4(t) was a slightly more compact function and rest of the script exactly the same, I did not have this issue.
I think the command "y = S4(t)" is the problem, but I don't see why it's not good. What am I doing wrong?
Thank you
15 comentarios
KSSV
el 24 de Jun. de 2017
What is class and size of y? You must know it better is the output y have same size as t, so that they can be plotted. We can help you more only on knowing s4.
Hayao
el 24 de Jun. de 2017
KSSV
el 24 de Jun. de 2017
Attach S4 function here...
KSSV
el 24 de Jun. de 2017
A 9MB .m file, I am looking for the first time in my life..... :| What for it is? I suspect something is wrong in understanding.
@Hayao: I do not understand, what you want to explain here. As KSSV has stated clearly, creating such huge M-files is a strange idea. It is unusual to store equations in this format. As long as the code does not define the type of "S(4)", the code must fail:
S4(t) =
(404934968861345816197309786212495*exp((3050546812132771*t)/89202980794122492566142873090593446023921664)) ... [left out the remaining MB...]
The blank line should cause an error message already. Then I do not think that the huge numbers are imported as you expect it. The strategy to create code in this way is flawed in every case.
Hayao
el 25 de Jun. de 2017
Walter Roberson
el 25 de Jun. de 2017
When I load your file in MATLAB it says NaN.
When I load your file in Maple it says unexpected end of file .
Could you save it as a .mat and attach that?
Hayao
el 25 de Jun. de 2017
Walter Roberson
el 25 de Jun. de 2017
Send me a message through my profile and I will reply and you can then attach on the return to that. Or just send me a link to a dropbox or googledrive or the like in the initial message.
Jan
el 25 de Jun. de 2017
Could you post the complete error message, please? The problem concerns reshape, but current we do not see this command in the posted code. In which line does the problem occur?
Jan
el 25 de Jun. de 2017
Ah, the partially contained message might mean, that this is a problem of sym/disp, so only the display in the command window is affected? Then try to supress this output using a semicolon.
Hayao
el 25 de Jun. de 2017
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Code Performance en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!