Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
How can I see all the results in a loop with interval and reorder the results to plot them
조회 수: 1 (최근 30일)
이전 댓글 표시
I'm working on that code
for i=[10:1:20];
for j=[21:1:30];
for k=[31:1:40];
for l=[41:1:50];
for m=[51:1:60];
for n=[61:1:70];
for o=[71:1:80];
A= [i 0 0 j 0 ; i j 0 0 0 ; j i 0 0 0 ; 0 j 0 i 0
j 0 0 0 i ; j 0 i 0 0 ; l 0 n 0 k ; o l m 0 k ; 0 j i 0 0 ; 0 l n k 0];
B= [100; 200; 300; 400 ; 500 ; 600 ; 700 ; 800 ; 900 ; 1000];
C= A\B
end
end
end
end
end
end
end
the results of this operation are columns with five values (ex: C=[c1; c2; c3; c4; c5]); but it changes according to the intervals of (i, j, k...).
- how can I get or see all the results, because when I check in the workspace I can read only the last results.
- also, how can I reorder the results like:
for each value of (i) we got c1, c2, c3, c4 and c5
for each value of (j) we got c1, c2, c3, c4 and c5
for each value of (k) we got c1, c2, c3, c4 and c5
.
.
.
for each value of (o) we got c1, c2, c3, c4 and c5
to plot them
Thank you.
댓글 수: 0
답변 (1개)
Jan
2018년 3월 21일
There is no need for the square brackets in the FOR loop arguments. See http://www.mathworks.com/matlabcentral/answers/35676-why-not-use-square-brackets.
The first loop has 11 iterations, the others have 10. Therefore you calculate 11*10^6 values.
C = zeros(5, 11e6);
index = 0;
for i = 10:1:20
for j = 21:1:30
for k = 31:1:40
...
index = index + 1;
C(:, index) = A \ B;
...
Are you aware that this a a large data set? I have no idea how such a pile of data could be visualized such, that a human can obtain any information from the diagram.
댓글 수: 2
Jan
2018년 3월 21일
@Redouane Ch: With the code I have suggested, the output matrix C does contain all calculated vectors. Does this solve your problem?
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!