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

14 Ansichten (letzte 30 Tage)
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 Kommentare
madhan ravi
madhan ravi am 20 Jan. 2019
so in vector B you want to ignore : 0/1 ?
nirit
nirit am 20 Jan. 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).

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

nirit
nirit am 20 Jan. 2019
Bearbeitet: nirit am 20 Jan. 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.

Weitere Antworten (0)

Kategorien

Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by