I have a character array called filename containing 'n040210'.
I have a structure S containing a field called 'n040210'
if i use...
SIZE ( S . n040210 {1} )
ans=
366 5
which is what i want.
but if i use...
SIZE ( S . filename {1} )
??? Reference to non-existent field 'filename'.
I need to use contents of filename as this procedure is part of a loop. what am I doing wrong?
many thanks
James
The error message means exactly what it says ... there is no field named "filename". You can use the evil eval function to get your desired result:
eval(['size(S.' filename '{1})'])
James Tursa
> I have a character array called filename containing 'n040210'.
> SIZE ( S . filename {1} )
> ??? Reference to non-existent field 'filename'.
> I need to use contents of filename as this procedure is part of a loop.
SIZE( S.(filename){1} )
Thanks for your help, the answer was staring me in the face.
thanks again