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

2 visualizaciones (últimos 30 días)
burges
burges el 17 de Mzo. de 2017
Editada: burges el 18 de Mzo. de 2017
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!.

Respuestas (1)

ES
ES el 17 de Mzo. de 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

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by