How to concatenate arrays of different size in a loop?
2 views (last 30 days)
Show older comments
Kyle Vanlerberghe
on 1 Dec 2019
Commented: KALYAN ACHARJYA
on 2 Dec 2019
I have been trying to concatonate arrays from multiple files in a loop. It worked fine when I could initialize a zeros array with set dimensions and append each column with a files data , such as:
set_length = 1875;
num_f = 18;
init = zeros(1875,18);
for i = 1: num_f
init(:,i) = file_content
But now I applied a filter to the data and the file_content arrays are all different, such as 105 x 1 or 371 x 1, is there any way I can set up the loop to concatonate these into one array?
0 Comments
Accepted Answer
KALYAN ACHARJYA
on 1 Dec 2019
Edited: KALYAN ACHARJYA
on 1 Dec 2019
How to concatenate arrays of different size in a loop?
result=0;
for i=1:iter_num
x_new= % array New generation
result=[result,x_new]
end
5 Comments
KALYAN ACHARJYA
on 2 Dec 2019
One way do the transpose and save it
or
result=[result; x_new]
%.............^
More Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!