필터 지우기
필터 지우기

Concatenating structure array with matrix

조회 수: 1 (최근 30일)
Alexandre
Alexandre 2014년 3월 13일
답변: Sarthak 2023년 2월 20일
Hi you all. How can i concatenate this files? Each one has structure array and a matrix with values.
  댓글 수: 1
dpb
dpb 2014년 3월 13일
Directly you can't. You'll need to create a new data storage scheme to handle the various types of data. Perhaps add the new array to the previous structure?

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

답변 (1개)

Sarthak
Sarthak 2023년 2월 20일
Hi,
As far as I have understood the question, you want to concatenate two files which contain array and matrix.
You can use ‘cat’ function for the same.
Please refer to the pseudo code below:
struct_concat = [];
for i = 1:numel(field_names) %field_names are the name of the fields in the structure
field = field_names{i};
struct_concat.(field) = [struct1.(field); struct2.(field)];
end

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by