Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to include cell arrays in a Matlab Embedded Function for simulink

Status
Not open for further replies.

erloroloco

Mechanical
Jan 16, 2007
2
The idea of the calculation is to make calculations on an input array (called p). Afterwards, a calculation of the standard deviation within a range is introduced and should be written out into the workspace. At the moment, the following statement does what I want, but only in the matlab environment.

function prms = RMS(p)

i=3000;
px=p-mean(p);

%calculation of the standard deviation within a range

for n=0:length(px)-1
py{n+1,:}=std(px(n+1:n+i,:));
end;

%convert cell array into a numerical array

for k=1:length(py)
for m=1:length(py{1})
NUM(m,k)=py{k}(m);
end;
end;

NUMOut=NUM';

Trying to include this simple functions in Simulink as Embedded ones, the following
error is reported:

"Unsupported: cell Arrays"

The calculation bases on a long array. Over this array the calulation
is done in 3000 array element intervals.

The question is: is there a way to convert the cell array format into another one supported by the "Embedded Function"? Or is simply another way of implementing this idea into Simulink?


Thank you very much in advance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor