From: Muhammed on
Hello everyone!

I have encountered some problems in an embedded function block. I have tried many ways to declare the output variables, but I couldn't make it. Below you can see my code:

function [d, phi_seg,Break]=seg(D,PHI_seg,index,D_size)
% d=eml.nullcopy(zeros(1,D_size));
% eml.varsize('d')

if index == D_size
Break = 1;
d=D(D_size);
phi_seg = PHI_seg(D_size);

elseif index > D_size
Break = 1;
d=D(D_size);
phi_seg = PHI_seg(D_size);

else
d=D(index+1);
phi_seg = PHI_seg(index+1);
Break = 0;
end

I would appreciate any help from you guys.
Muhammed Hanouti
From: Christopher on
"Muhammed " <lynx689(a)hotmail.com> wrote in message <i0gb4t$hvn$1(a)fred.mathworks.com>...
> Hello everyone!
>
> I have encountered some problems in an embedded function block. I have tried many ways to declare the output variables, but I couldn't make it. Below you can see my code:
>
> function [d, phi_seg,Break]=seg(D,PHI_seg,index,D_size)
> % d=eml.nullcopy(zeros(1,D_size));
> % eml.varsize('d')
>
> if index == D_size
> Break = 1;
> d=D(D_size);
> phi_seg = PHI_seg(D_size);
>
> elseif index > D_size
> Break = 1;
> d=D(D_size);
> phi_seg = PHI_seg(D_size);
>
> else
> d=D(index+1);
> phi_seg = PHI_seg(index+1);
> Break = 0;
> end
>
> I would appreciate any help from you guys.
> Muhammed Hanouti

What do you mean 'you couldn't make it'? Do no values get returned when you execute the function? Are you sure it's entering the function? Depending on the rest of your code, the function may need to be ended with an additional 'end' statement.