From: John Dim on
Hello,

I have the matrices:

E = [1 8 ; 2 9;3 10; 4 6; 5 7; 1 2 ; 2 3 ; 3 4 ; 4 5 ; 5 1;
6 7 ; 7 8 ; 8 9 ; 9 10 ; 10 6;1 7 ; 2 8;3 9; 4 10; 5 6] ;

r=[cos(pi/5) -sin(pi/5) 0 ; sin(pi/5) cos(pi/5) 0; 0 0 1];

b = [0 1 0 ; -s1 c1 0 ; -s2 -c2 0 ; s2 -c2 0 ; s1 c1 0 ] ;

N=vertcat(r , r*b) ;

AND I try to create a data structure:

for i = 1 : length(E)
EL(i).NN(1) = E(i , 1) ;
EL(i).NN(2) = E(i , 2) ;
end

and it seems everything is ok till this point.

However, when a use a function that I made which is:

FNd = EL(i).ND(1);
SNd = EL(i).ND(2);

I get the error message:

??? Improper index matrix reference.

Error in ==> threedmodelsymmetrystructure at 15
FNd = EL(i).ND(1);

Does anybody know why this happens and how can I tackle this problem???
From: Matt J on
"John Dim" <mitsoujohn(a)yahoo.com> wrote in message <hnvjjm$mfb$1(a)fred.mathworks.com>...

> Does anybody know why this happens and how can I tackle this problem???

Maybe if you showed us how the data EL(i).ND(j) was built. You 've only showed us
data EL(i).NN(j), which seems fine.
From: Jos (10584) on
"John Dim" <mitsoujohn(a)yahoo.com> wrote in message <hnvjjm$mfb$1(a)fred.mathworks.com>...
> Hello,
>
> I have the matrices:
>
> E = [1 8 ; 2 9;3 10; 4 6; 5 7; 1 2 ; 2 3 ; 3 4 ; 4 5 ; 5 1;
> 6 7 ; 7 8 ; 8 9 ; 9 10 ; 10 6;1 7 ; 2 8;3 9; 4 10; 5 6] ;
>
> r=[cos(pi/5) -sin(pi/5) 0 ; sin(pi/5) cos(pi/5) 0; 0 0 1];
>
> b = [0 1 0 ; -s1 c1 0 ; -s2 -c2 0 ; s2 -c2 0 ; s1 c1 0 ] ;
>
> N=vertcat(r , r*b) ;
>
> AND I try to create a data structure:
>
> for i = 1 : length(E)
> EL(i).NN(1) = E(i , 1) ;
> EL(i).NN(2) = E(i , 2) ;
> end
>
> and it seems everything is ok till this point.
>
> However, when a use a function that I made which is:
>
> FNd = EL(i).ND(1);
> SNd = EL(i).ND(2);
>
> I get the error message:
>
> ??? Improper index matrix reference.
>
> Error in ==> threedmodelsymmetrystructure at 15
> FNd = EL(i).ND(1);
>
> Does anybody know why this happens and how can I tackle this problem???

This is the same error you get when you do this

EL = @() struct('nd',1) ;
EL(i).nd

What, exactly, is EL in "a function that you made"? See

which EL
whos EL

hth
Jos
 | 
Pages: 1
Prev: Reduce legend size
Next: Reduce legend size