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



Vectorize a cell array
Posted:
Jul 25, 2011 11:00 AM


Hello! (this is a 2 parter)
I'm currently working on a minimization problem that I start out with several vectors that are the same size, then I remove data points from each of the vectors depending on the coherence (that part doesn't really matter) so in the end I end up with let's say 4 vectors of different lengths that I want to combine and run the minimization on.
My goal is to keep each of these vectors separate (for purposes of plotting later and checking my data) so I've started to use cell arrays. Currently I have a cell array that's 1x4 and has elements {506x1}, {385x1}, {248x1}, {247x1} and I want to find a way that I can turn it from the cell array in that configuration to a vector that would be (1413x1) that I can run my minimization on. Does anyone know how to efficiently do this? I feel like I could do it with a series of loops but there must be a quicker way to do it.
Also, my final goal is to then repopulate my cell arrays with 0's where the points I previously removed data from for plotting and I've looked around on how to do that and found "cellfun" but according to the documentation it would have to be the same size as the original, again any help on how to do this efficiently would be greatly appreciated! Thanks!



