Concatenating structure array with matrix
1 次查看(过去 30 天)
显示 更早的评论
Hi you all. How can i concatenate this files? Each one has structure array and a matrix with values.
1 个评论
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
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!