# Function call problem. How to solve it?

2 views (last 30 days)
tabw on 19 Aug 2014
Commented: Adam on 19 Aug 2014
I have a function, sliceobject(im). I used another m file to compute the input im. After that I used sliceobject(im) But the output can't show in workspace.
I directly use sliceobject with im input is okay.
how to show the output from sliceobject(im)
##### 2 CommentsShowHide 1 older comment
tabw on 19 Aug 2014
function [ ] = SliceObject( im )
number=0;
abc=[];
abcd=[];
N=500;
k=1;
q=1;
l=q+1;
t=1;
constant=1;
control=[];
testvalue=;
Structure(N).result=zeros(15);
Result(N).volume=zeros(3);
Cell=im;
[R C]=size(Cell);
temp1=[];
num=0;
result=[];
counter=1;
for i= 1:R
for j=1:C
Cell(j,i);
if (find(Cell(j,i))==1)
temp=[i j];
temp1=cat(2,temp1,temp); % store all the true pixel into array
num=num+1;
end
end
end
a=temp1(counter); % true pixel
b=temp1(counter+1);
while (counter<=(size(temp1,2)-2))
j=(a-1)*R+b;
result=cat(2,result,j);
c=temp1(counter+2);
d=temp1(counter+3);
x=((c-a)^2+(d-b)^2)^(1/2);
if (x <= (2)^(1/2))
else
temp00=[];
temp00=result;
Structure(k).result=temp00;
k=k+1;
result=[];
number=number+1;
end
counter=counter+2;
a=temp1(counter);
b=temp1(counter+1);
end
while (l<=number)
tempcon=(abs(bsxfun(@minus,Structure(q).result',Structure(l).result)));
ans=(tempcon==R|tempcon==R-1|tempcon==R+1);
Tr=find(ans==1);
if (Tr>=1)
Structure(q).result=struct('object',[Structure(q).result Structure(l).result]);
Structure(q).result=Structure(q).result.object;
control=[control,q,l];
a=control;
end
if (l==number)
Result(t).volume=Structure(q).result;
aaa=q;
q=(1:number);
q=setdiff(q,control);
aa=q;
l=q(2);
q=q(1);
if (q==aaa)
control=[control,q];
q=(1:number);
q=setdiff(q,control);
l=q(2);
q=q(1);
end
t=t+1;
else
if (l==2)
l=l+1;
else
y= (isempty(Tr));
if (y==1)
l=l+1;
end
end
while any(l==a) && (l<number)
l=l+1;
end
end
end

result = sliceobject(im);
should work fine.
Occasionally I find that my workspace doesn't refresh itself so I press F5 or just type e.g. 'result' on the command line to force the update and double check 'result' is in fact in the workspace.