Assign values in the cell

12 views (last 30 days)
Turbulence Analysis
Turbulence Analysis on 16 Jul 2021
Commented: Rik on 16 Jul 2021
I have the 72 x 1 cell named output 1 (attached here).
As shown in the attachment, some cells got empty matrix, I intend to add zero values in the manner of 8x1 into all the all empty cells ..
Any idea how to assign this .. ??

Accepted Answer

Rik on 16 Jul 2021
Edited: Rik on 16 Jul 2021
You mean like this?
output1={[1 2;3 4],[]};
output1 = 1×2 cell array
{2×2 double} {8×1 double}
Note that cellfun has a legacy mode, which is often much faster, but is limited in terms of what data types will work.
Rik on 16 Jul 2021
You can either use reshape to make sure your cell array is a row vector, or use horzcat and a comma separated list:

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!