How to fix Cell contents assignment to a non-cell array object ERROR?

1 view (last 30 days)
Below is my code that keeps outputting the following error: Cell contents assignment to a non-cell array object.
for i=1:10
windowdata{i}=workingdata(window(i):window(i+1));
indvals{i}=find(windowdata{i}>0.2 & windowdata{i}<0.4);
end
Essentially, I am trying to make windowdata a cell array containing data values from a windowed data set. 'Window' is previously define before the for loop. Then, I will extract all indices for which the values of 'windowdata' are above 0.2 and less than 0.4. These values will also be stored into a cell array named 'indvals'.
I am truly at a road block here and would appreciate any help. Thank you.

Answers (1)

Star Strider
Star Strider on 20 Aug 2015
You probably defined ‘windowdata’ or ‘indvals’ as something else earlier in your code. The easiest way to fix this is to rename them in your loop to something similar, but not the same.
For example, this code:
windowdata = 1;
windowdata{1} = eps;
throws the same error.
  4 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!