How to display data from a table using fprintf?

조회 수: 2 (최근 30일)
Ahmed Tohamy
Ahmed Tohamy 2020년 12월 8일
댓글: Jon 2020년 12월 8일
i'm trying to fprintf ('The Maximum Number of Cases Are: %d on %f', X) but i know im using the wrong code!! please HELP!

답변 (2개)

Cris LaPierre
Cris LaPierre 2020년 12월 8일
See the various ways to access data in a table here.
I think you want this
DATE = datetime(2020,06,19,"Format","MM/dd/yy");
DAILYCASES = 1774;
X=table(DATE,DAILYCASES)
X = 1x2 table
DATE DAILYCASES ________ __________ 06/19/20 1774
fprintf ('The Maximum Number of Cases Are: %d on %s', X.DAILYCASES,X.DATE)
The Maximum Number of Cases Are: 1774 on 06/19/20

Jon
Jon 2020년 12월 8일
편집: Jon 2020년 12월 8일
fprintf ('The Maximum Number of Cases Are: %d on %f', X.DAILYCASES,X.DATE)
  댓글 수: 2
Jon
Jon 2020년 12월 8일
you could also index directly into the original table
Jon
Jon 2020년 12월 8일
I just noticed that Chris had already answered while I was editing my reply

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

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by