How do I loop this data?

2 Ansichten (letzte 30 Tage)
Jack
Jack am 26 Feb. 2015
Beantwortet: Joseph Cheng am 26 Feb. 2015
% Degrees of Freedom;
% Free
Bl=1;
BR=hd+1;
TL=(hd+1)*(vd+1)-hd;
TR=(hd+1)*(vd+1);
freedof=[Bl,BR,TL,TR];
for i=Bl+1:BR-1;
freedof(i)=[3i-2 3i-1 3i];
end
for i = BR+1:1:TL-1
end
for i=TL+1:1:TR-1
end
error comes back as :
In an assignment A(I) = B, the number of elements in B and I must be the same.
Error in FDM>readinputdata (line 80) freedof(i)=[3i-2 3i-1 3i];
Error in FDM (line 9) [ndof,nnodes,connectivity,q,freedof,P,fixdof,Uf,axialunits,lengthunits]=readinputdata; >>

Antworten (1)

Joseph Cheng
Joseph Cheng am 26 Feb. 2015
from what i see, without running it, is that in the freedof(i)=[3i-2 3i-1 3i]; it is trying to assign all 3 3i-2 3i-1 3i] into the index freedof(i) which is 1x1. to get around this you can go
freedof(i,:)=[3i-2 3i-1 3i];
one other thing i see is that you define freedof right before the for loop as a 1x4 matrix. however in the forloop freedof is 1x3. what are you looking for the other number?

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by