How do i store new data into an existing cell array?

2 ビュー (過去 30 日間)
burges
burges 2017 年 3 月 17 日
編集済み: burges 2017 年 3 月 18 日
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!.

回答 (1 件)

ES
ES 2017 年 3 月 17 日
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

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by