How to store multiple arrays into a single one?
55 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Mariana
el 3 de Mayo de 2020
Comentada: Mariana
el 3 de Mayo de 2020
array_1 = zeros(1,9);
array_2 = zeros(500,16);
With the increase in time I will be concatenating arrays one and two into array3. I tried it by doing this:
array_3 = [array_1,array2];
Since, they are not from the same size, they can´t be concatenated.
Any ideas on how can I save them?
0 comentarios
Respuesta aceptada
Stephen23
el 3 de Mayo de 2020
Use a cell array:
C = {array_1,array_2}
3 comentarios
Stephen23
el 3 de Mayo de 2020
"Is it better to use an cell array or an structure?"
It depends entirely on what you are doing:
- if your data have an inherent sequence, then use a container array which can be accessed using indices (e.g. cell array, non-scalar structure, table rows).
- if your data are best identified by parameter names, then use a container array which lets you use names (e.g. structure, table columns).
Use the simplest data type that can reasonably hold your data, as this will simplify your code.
Más respuestas (0)
Ver también
Categorías
Más información sobre Simulink Functions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!