Solve memory allocation problems in the script of a "Matlab Function" ?
1 次查看(过去 30 天)
显示 更早的评论
Hello everyone, First I use Matlab&Sumilink 2012 32bits on Windows Seven.
I am trying desperately to get a "Matlab function" (block Simulink) with an output whose size is variable.
Let me explain, in my code, the output of the Matlab function can be different sizes depending on the progress of the simulation state. At first it is a matrix [1x7] then [1x10] and the rest of the time it is a matrix [1x18]. Data from this output correspond to a frame that I send to Herkulex motors through a serial port.
I already tried to pre-allocate memory in this way :
DATA=zeros(1,7);
It works for mi first case but not in the others where DATA is a matrix [1x10] or [1x18].
How can I do to solve this problem? please
I tried to allocate many times differently but the compiler shows this error:
Size of DATA cannot be modified as the variable DATA is already locked
So How can I do to modify this memory allocation within allocate many times? I can't have many times the same serial port I already did the test.
Thanks for your answers,
Alexis
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!