Plot text with numbers

조회 수: 5 (최근 30일)
Ivan Mich
Ivan Mich 2020년 9월 8일
댓글: Star Strider 2020년 9월 10일
Hello,
I have a question about a code. I have one file in which:
The first column has cell (text) arrays
The second has numbers (double)
In my plot x axis has text and y axis has numbers
I would like to plot x axis with y axis.
I am uploading this file.
How could I make it?

채택된 답변

Star Strider
Star Strider 2020년 9월 8일
Try this:
T1 = readtable('test.xlsx');
vars = T1.Properties.VariableNames;
figure
plot(T1{:,2})
Ax = gca;
Ax.XTick = 1:numel(T1{:,1});
Ax.XTickLabel = T1{:,1};
xlabel(vars{1})
ylabel(vars{2})
producing:
Note that table objects have specific indexing and variable reference requirements. The readtable function was introduced in R2013b.
.
  댓글 수: 2
Ivan Mich
Ivan Mich 2020년 9월 10일
Thank you very much !!!
Star Strider
Star Strider 2020년 9월 10일
As always, my pleasure!

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

추가 답변 (1개)

KSSV
KSSV 2020년 9월 8일
편집: KSSV 2020년 9월 8일
[num,txt,raw] = xlsread("test.xlsx") ; % can also use readtable
plot(num)
xticklabels(txt)
  댓글 수: 4
KSSV
KSSV 2020년 9월 8일
편집: KSSV 2020년 9월 8일
See to it that ...the text should be all your text in cells....
T = readtable("test.xlsx") ;
plot(T.2)
xticklabels(T.1)
Ivan Mich
Ivan Mich 2020년 9월 8일
KSSV I am sorry, but still not working

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

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by