From: Claudio Pedrazzi on 10 Mar 2010 10:56 Hi everybody, I -think- I have an error message induced by the installation of R2010a (not completely sure, but at the moment I see no other possible explanation). I get "N-dimensional indexing allowed for Full matrices only" with such a statement structure for i=1:n_row for j= 1:n_col rfm(1,i,j)=data(i+1,j+1); end end where "data" is a sparse matrix This part of the application is not written by me, and it used to work until the installation of R2010a, that I did today. Can this be the reason? I guess that the rfm matrix does not like to be sparse because it has three indexes. What kind of work-around can be used, without changing all the rest of the code (I am aware of the possibility of making rfm a cell array of 2D matrix, but this would change all the syntax). Thanks a lot for any help Regards Claudio
From: Matt J on 10 Mar 2010 11:18 "Claudio Pedrazzi" <firstnameinitial.lastname(a)company.it> wrote in message <hn8fem$krm$1(a)fred.mathworks.com>... > Hi everybody, > I -think- I have an error message induced by the installation of R2010a (not completely sure, but at the moment I see no other possible explanation). > > I get > "N-dimensional indexing allowed for Full matrices only" > with such a statement structure > > for i=1:n_row > for j= 1:n_col > rfm(1,i,j)=data(i+1,j+1); > end > end > > where "data" is a sparse matrix > > This part of the application is not written by me, and it used to work until the installation of R2010a, that I did today. Can this be the reason? =================== I don't have R2010a, but I can tell you that this would never have worked in earlier MATLAB versions either if rfm was a sparse array. It could be important to figure out why it became so in R2010a. When you type data(1,1), could you copy paste exactly what you see? In R2009b, it would have been a full scalar, but if in R2010a it's a sparse scalar that could explain the problem. In any case, a solution might be the following 1-line change rfm(1,i,j)=full( data(i+1,j+1) );
From: EBS on 10 Mar 2010 13:47 "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hn8gnt$g9f$1(a)fred.mathworks.com>... > "Claudio Pedrazzi" <firstnameinitial.lastname(a)company.it> wrote in message <hn8fem$krm$1(a)fred.mathworks.com>... > > Hi everybody, > > I -think- I have an error message induced by the installation of R2010a (not completely sure, but at the moment I see no other possible explanation). > > > > I get > > "N-dimensional indexing allowed for Full matrices only" > > with such a statement structure > > > > for i=1:n_row > > for j= 1:n_col > > rfm(1,i,j)=data(i+1,j+1); > > end > > end > > > > where "data" is a sparse matrix > > > > This part of the application is not written by me, and it used to work until the installation of R2010a, that I did today. Can this be the reason? > =================== > > I don't have R2010a, but I can tell you that this would never have worked in earlier MATLAB versions either if rfm was a sparse array. It could be important to figure out why it became so in R2010a. > > When you type data(1,1), could you copy paste exactly what you see? In R2009b, it would have been a full scalar, but if in R2010a it's a sparse scalar that could explain the problem. > > In any case, a solution might be the following 1-line change > > rfm(1,i,j)=full( data(i+1,j+1) ); Yes, you're running into the result of a bug fix (previous behavior was incorrect) and Matt's solution will work (beware of line break in link): http://www.mathworks.com/access/helpdesk/help/techdoc/rn/bsdgysw-1.html#bseheyh-1
From: Matt J on 10 Mar 2010 14:02 "EBS " <ericDOTsampson(a)gmail.com> wrote in message <hn8pfq$m0c$1(a)fred.mathworks.com>... > > In any case, a solution might be the following 1-line change > > > > rfm(1,i,j)=full( data(i+1,j+1) ); > > Yes, you're running into the result of a bug fix (previous behavior was incorrect) and Matt's solution will work (beware of line break in link): =========== Of course, the for-loop is incredibly inefficient. You would be better off doing rfm=permute( full( data(2:n_row+1,2:n_col+1) ) ,[3 1 2]); It's also a mystery why data was a sparse matrix in the first place, since it was simply read into the non-sparse array rfm.
From: James Tursa on 10 Mar 2010 15:10 "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hn8qbd$jap$1(a)fred.mathworks.com>... > "EBS " <ericDOTsampson(a)gmail.com> wrote in message <hn8pfq$m0c$1(a)fred.mathworks.com>... > > > > In any case, a solution might be the following 1-line change > > > > > > rfm(1,i,j)=full( data(i+1,j+1) ); > > > > Yes, you're running into the result of a bug fix (previous behavior was incorrect) and Matt's solution will work (beware of line break in link): > =========== > > Of course, the for-loop is incredibly inefficient. You would be better off doing > > rfm=permute( full( data(2:n_row+1,2:n_col+1) ) ,[3 1 2]); > > It's also a mystery why data was a sparse matrix in the first place, since it was simply read into the non-sparse array rfm. One reason might be data may be a huge sparse matrix, whereas rfm may be only a much smaller full sub-matrix portion of it. James Tursa
|
Next
|
Last
Pages: 1 2 Prev: please help : ??? Index exceeds matrix dimensions. Next: how to plot a graph |