Solve memory allocation problems in the script of a "Matlab Function" ?

조회 수: 1 (최근 30일)
Alexis Artuso
Alexis Artuso 2016년 6월 8일
편집: Alexis Artuso 2016년 6월 8일
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개)

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by