I would like to preallocate the following structure before a for-loop. It is used to save M=getframe(i)
.
I tried the following:
M=struct(cdata, zeros(1,559), colormap);
Which logically comes up with:
Undefined function or variable 'cdata'.
Question Is there a way to pre-allocate the structure for a movie directly ? Or do I have to assign 343x434x3 uint 8 to cdata ? (And if yes how would I do that?).
EDIT I guess this is not a duplicate of the following thread, as this is specially about the pre-allocation of a movie struct. How to initialize an array of structs in MATLAB?
@ Luis Mendo
I tried pre-allocating your way:
comes up with the following problem:
Conversion to uint8 from struct is not possible.
Error in UG9 (line 238)
M(i)=getframe;
I would be glad for any help, maybe I just dont understand the method of pre-allocating as described in the above thread.