필터 지우기
필터 지우기

Concatenating array using for loop

조회 수: 1 (최근 30일)
aldburg
aldburg 2018년 2월 18일
댓글: Stephen23 2018년 2월 19일
I have a structure with some arrays listed like this from 1 to 9 :
Cure.neat(1).temps
Cure.neat(2).temps
.....
I would like to combine the arrays into one matrix such as:
A = [ Cure.neat(1).temps Cure.neat(2).temps etc... ]
for i = 1 :9

채택된 답변

aldburg
aldburg 2018년 2월 18일
I was able to get it to work with the following code:
% Forms matrix to hold data
Master_temps = zeros(numel(Cure_Kinetics.neat(1).iterated.temps), number_of_data_files)
% Compiles all neat iterated temps into one master matrix
for i = 1:number_of_data_files
Master_temps(:,i) = Cure_Kinetics.neat(i).iterated.temps
end
% Places master matrix into data structure
Cure_Kinetics.neat_model.compiled_temps = Master_temps
  댓글 수: 1
Stephen23
Stephen23 2018년 2월 19일
See my answer for a simpler solution.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Stephen23
Stephen23 2018년 2월 18일
편집: Stephen23 2018년 2월 18일

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by