필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
nirit
nirit 2019년 1월 20일
댓글: Stephen23 2019년 1월 20일
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
madhan ravi
madhan ravi 2019년 1월 20일
so in vector B you want to ignore : 0/1 ?
nirit
nirit 2019년 1월 20일
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).

댓글을 달려면 로그인하십시오.

채택된 답변

nirit
nirit 2019년 1월 20일
편집: nirit 2019년 1월 20일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by