Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


ulas
Posts:
13
From:
istanbul
Registered:
7/17/08


Re: subscript error
Posted:
Mar 13, 2009 9:33 AM


Hello
thanks a lot , it worked
Ulas
"G. B." <gavrilo.dot.bozovic@gmail.dot.ch> wrote in message <gpdkgf$n0s$1@fred.mathworks.com>... > "ulas im" <ulasim77@gmail.com> wrote in message <gpdjcp$abo$1@fred.mathworks.com>... > > Dear Matlab users > > > > ı am trying to run the short code below but i keep getting the error: > > ??? Assignment has fewer nonsingleton rhs dimensions than nonsingleton > > subscripts > > > > the error occurs when it runs for the hour 9 and passes to hour 10: > > > > for time=0:23 > > > > filename=['FinalEmission_Day1_Spe1_Hour',num2str(time)]; %CO > > load(filename); > > t=num2str(time); > > > > EmmTemp=zeros(163,150,20,24); > > > > EmmTemp(:,:,:,t)=B(:,:,:); > > > > clear B t filename EmmTemp; > > > > end > > > > what is the source of this problem? > > > > Ulas > > when you do: > > t = num2str(time); > > you are assigning a string to "t". you cannot then use "t" as an index in an array. > > Then, Matlab has no 0 indexes, it starts at 1, so you should do: > > EmmTemp(:,:,:,time+1) = B(:,:,:); > > In addition, you are initializing and clearing EmmTemp at each iteration of the for loop, so you won't have anything in the end



