How to create an double for loop in matlab?
Show older comments
Hi, I want to create a double loop where one loop would go across each matrix and the second loop would go through the individual matrix. For example, I have 4 matrices in list names A through D and within each of these matrices are 5 variables. The following code would generate 4 matrices and within each consists of five variables.
A = rand(100,5);
B = rand(100,5);
C = rand(100,5);
D = rand(100,5);
%
% To create a double loop
for i = 1:size(A,2)-1
for j = A:D
Tables.Table{j}(:,1) = corr({j}(:,1), {j}(:,i+1));
end
end
Can somebody please guide me on this?
Thank you very much for your time and consideration.
Yahya
Answers (1)
dpb
on 5 Jun 2017
0 votes
"I have 4 matrices in list names A through D..."
Categories
Find more on Loops and Conditional Statements 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!