Warning: Concatenation involves an empty array with an incorrect number of columns

  • Follow


Hi all,

I'm getting the following message upon executing my code:
Warning: Concatenation involves an empty array with an incorrect number of columns.
This may not be allowed in a future release. 

What the code does is running a for-loop that generates a cell array for each year and put it together with the cell array with all the previous years' data piled up. The warning message above is directed at this line:
all_year = [all_year;each_year];

I don't know exactly on what occasions one gets the message above, and in the future release, what needs to be done. 
0
Reply loooooo (29) 11/13/2011 10:40:29 PM

"Jason " <loooooo@hotmail.com> wrote in message 
news:j9ph0t$hnm$1@newscl01ah.mathworks.com...
> Hi all,
>
> I'm getting the following message upon executing my code:
> Warning: Concatenation involves an empty array with an incorrect number of 
> columns.
> This may not be allowed in a future release.
> What the code does is running a for-loop that generates a cell array for 
> each year and put it together with the cell array with all the previous 
> years' data piled up. The warning message above is directed at this line:
> all_year = [all_year;each_year];
>
> I don't know exactly on what occasions one gets the message above, and in 
> the future release, what needs to be done.

find out the sizes of all_year and each_year - that should elucidate what's 
going on.

-- 
Loren
http://blogs.mathworks.com/loren/
http://www.mathworks.com/matlabcentral/ 

0
Reply loren.shure (822) 11/14/2011 4:32:51 PM


Thanks Loren.

I'm getting the results somehow, regardless of the warning message. 
But if what matters here is the size of the cell arrays that keeps building up, I can't think of any other efficient alternatives.
It's always best to assigning an empty array before the loop in which the results are to be saved, what if I don't have a clue in advance how big the end product will be?


"Loren Shure" <loren.shure@mathworks.com> wrote in message <j9rfrj$sdc$1@newscl01ah.mathworks.com>...
> 
> "Jason " <loooooo@hotmail.com> wrote in message 
> news:j9ph0t$hnm$1@newscl01ah.mathworks.com...
> > Hi all,
> >
> > I'm getting the following message upon executing my code:
> > Warning: Concatenation involves an empty array with an incorrect number of 
> > columns.
> > This may not be allowed in a future release.
> > What the code does is running a for-loop that generates a cell array for 
> > each year and put it together with the cell array with all the previous 
> > years' data piled up. The warning message above is directed at this line:
> > all_year = [all_year;each_year];
> >
> > I don't know exactly on what occasions one gets the message above, and in 
> > the future release, what needs to be done.
> 
> find out the sizes of all_year and each_year - that should elucidate what's 
> going on.
> 
> -- 
> Loren
> http://blogs.mathworks.com/loren/
> http://www.mathworks.com/matlabcentral/ 
0
Reply loooooo (29) 11/16/2011 8:34:14 AM

2 Replies
30 Views

(page loaded in 0.056 seconds)


Reply: