Using .data{1,i} in a for loop

5 views (last 30 days)
bugatti79
bugatti79 on 18 Oct 2013
Commented: bugatti79 on 18 Oct 2013
Hi Folks,
I have a 1*12 cell array which contains twelve 1*1 struct arrays. Each of which subsequently contains a matrix and it is in the form
Test{1,i}.data
I am struggling to implement the above line in a for loop. Here it is
for i=1:5
Work(i)=Constant.*Test{1,i}.data.*Increment;
end
I get error stating "In an assignment A(I) = B, the number of elements in B and I must be the same." Any ideas?
Thanks in advance B
  1 Comment
ES
ES on 18 Oct 2013
Edited: ES on 18 Oct 2013
What is 'Work'?

Sign in to comment.

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 18 Oct 2013
Use Work{i} instead of Work(i)

More Answers (1)

Andrei Bobrov
Andrei Bobrov on 18 Oct 2013
for ii = 1:5, Work{ii}=Constant.*Test{1,ii}.data.*Increment; end

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!