# Issue with cell during for loop operation

1 view (last 30 days)
Turbulence Analysis on 4 Feb 2022
Hi,
I am genrating cells of size 1 x 200 through for loop operation. Ideally, for each iteation I should get a array of size 100 x 3 double in each cell. However, as shown in the attached .mat file, the first array is 38 x 3. Over here, my intenstion is to insert zero into the missed entries, in such a way to make all the arrays of size 100 x 3.. Could someone help me with this ??
##### 2 CommentsShowHide 1 older comment
Turbulence Analysis on 4 Feb 2022
Hi,
Sorry, that was a mistake in the previously attached file. Here, I have uploaded the new file.
For instance, if we consider the first entry i.e. Data1 {1,1} (in the attached file) where the array size is 38 x 3. Here, for instance, in the third column, the entries starting from 7, 8, 10 ..., here my goal is insert zero for the missing no's i.e. for 1 to 6.. likewise for all the missing no's in the third column... In this way, the third column will have no's to 1 to 100 and size of all the entries will be uniform i.e. 100 x 3..
Hope this helps!!

Benjamin Thompson on 4 Feb 2022
You can always copy a cell into a temp array, add zeros to increase array size, then write it back to the cell array:
temp = Data{1};
Data{1} = zeros(100,3);
size(temp)
temp((size(temp,1)+1):100,:) = 0;
Data{1} = temp;
size(Data{1})
##### 2 CommentsShowHide 1 older comment
Turbulence Analysis on 4 Feb 2022
Thanks.
However, the idea is to insert zero entry into the second column with respect to the missing number in the third colum.. As shown in the attached figure..
In this the third column always have numbers starting from 1 to 100 without any discontinuties, so the size will be 100 x 3

### Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by