How do i store new data into an existing cell array?
2 views (last 30 days)
Show older comments
Assuming i have a cell array:
myArray = {NaN, 'm', 'b', NaN};
And i have a while loop within which i call the function that produces a new result:
myArray = {NaN, NaN, NaN, 'n'};
How do i append the new result into the existing one such that i still have a 1x4 array with the cells as follows:
[{NaN, NaN}] [{'m', NaN}] [{b, NaN}] [{NaN, 'n'}]
Thank you in advance!.
0 Comments
Answers (1)
ES
on 17 Mar 2017
once you have myArray = {NaN, 'm', 'b', NaN}; and myArray 1 = {NaN, NaN, NaN, 'n'};, you can run a for loop over them and concatenate.
for iloop=1:4
output{iloop,1} = myArray{iloop};
output{iloop,2} = myArray1{iloop};
end
0 Comments
See Also
Categories
Find more on Matrices and Arrays 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!