Same problem

Thread Starter

Seio

Joined Feb 16, 2012
1
Hi to all,
i have a problem with my simulink model. I' have write a function, with a for cicle, that work whit the entire array X and generate an array Y. This function work well if I stay in script mode. When I' m using in a MATLAB Function block, it don't work.
The function is:
Rich (BB code):
function S=F(R)
S=zeros(1,length(R));
for i=1:length(R)
    S(i)=sum(R(1:i)); 
end
It seems that it can't read more than one element at a time, in fact the output array is equal than the input when I use this function in simulink
Anyone have any suggestion?
What I am doing wrong

Thank you
 
Top