How do i make an array like this?

Currently i have this variable.
Can i check how do i make the array to become like this? Theres 2 rows of empty spacing for every value.
4
5
5
5

3 comentarios

Adam
Adam el 30 de Oct. de 2019
You can't have empty space in a numeric array. You would have to convert to a cell array or string array, or put NaNs inbetween instead.
Yuan Jun Lim
Yuan Jun Lim el 30 de Oct. de 2019
If i were to put NANs in between,
how do i write it?
Sorry , i'm quite new to this.
x = [4; NaN; NaN; 5; NaN; NaN; 5; NaN; NaN; 5];
%or
x = {};
x{1,1} = 4;
x{4,1} = 5;
x{7,1} = 5;
x{10,1} = 5;
%or
x = ["4";"";"";"5";"";"";"5";"";"";"5"]

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Data Types en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 30 de Oct. de 2019

Comentada:

el 30 de Oct. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by