How to store vectors in a 3d matrix using a for loop
2 次查看(过去 30 天)
显示 更早的评论
I imported the data from the file and I want to store the Ra and Nu values for each unique value of A in a 3d matrix using for loop.This is what I have so far:-
if true
% code
end% Import data
Experimental_data = importdata('experimental_data_1.csv');
% Extract details
text_data=Experimental_data.textdata;
% Use for loop to restructure data
for i=1:length(A_unique);
Ra=?
Nu=?
A_unique(:,:,i)=[Ra,Nu];
end
Pls guide me on how to write the for loop?
num_data = Experimental_data.data;
% Extract from columns
A=num_data(:,1);
Ra=num_data(:,2);
Nu=num_data(:,3);
% Find unique values of A
A_unique=unique(A);
1 个评论
Adam
2017-5-19
You shouldn't need a loop. What does your data look like after you have imported it? Are A, Ra and Nu three separate variables?
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!