How to store vectors in a 3d matrix using a for loop

조회 수: 2 (최근 30일)
Sook Yee Lim
Sook Yee Lim 2017년 5월 19일
댓글: Adam 2017년 5월 19일
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
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 CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by