How can I display string vector the same way number vectors are displayed

10 visualizaciones (últimos 30 días)
I have two long vectors:
vector A- int vector with size 1xN
vector B string vector with size of 1xM.
I want to use disp() for displaying both on the command window.
when using disp(A) : since the vector is too long , it automatally show it the folowing way:
Columns 1 through 9
19 21 112 113 23 24 25 26 28
Columns 10 through 18
31 33 117 35 52 54 58 62 68
Columns 19 through 27
69 94 97 100 109 20075 20080 20083 20095
Columns 28 through 30
20099 20110 20124
and that is OK, thats what I want beacuse it is convinent.
but when using disp() with vector B I one giant line , like so:
7 : 0/1, 9 : 0/1, 11 : 0/1, 21 : 1/2, 112 : 0/1, 113 : 0/1, 23 : 3/6, 24 : 6/14, 25 : 3/6, 28 : 2/4, 30 : 1/2, 31 : 2/3, 32 : 1/2, 33 : 1/2, 34 : 2/4, 117 : 2/3, 35 : 3/6, 39 : 0/1, 40 : 0/1, 41 : 0/1, 43 : 0/1, 46 : 0/1, 47 : 0/1, 52 : 0/1, 54 : 0/1, 58 : 0/1, 94 : 1/2, 97 : 1/2, 103 : 0/1, 20070 : 0/1, 20071 : 0/1, 20072 : 0/1, 20073 : 0/1, 20075 : 0/1, 20076
(each value in the string array contains the pattern: "x : y/z,"
How can I display string vector the same way number vectors are displayed?
  2 comentarios
madhan ravi
madhan ravi el 20 de En. de 2019
so in vector B you want to ignore : 0/1 ?
nirit
nirit el 20 de En. de 2019
no.
I want to display all of the data of vector B,
only to show it nicely (aka, lines seperation ) like int/double vector has (example above).

Iniciar sesión para comentar.

Respuesta aceptada

nirit
nirit el 20 de En. de 2019
Editada: nirit el 20 de En. de 2019
Ok. I manage to solve this just by declaring vector B values as
"x : y/z," instead of 'x : y/z,' like I did before.

Más respuestas (0)

Categorías

Más información sobre Characters and Strings 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