table row not selecting

1 回表示 (過去 30 日間)
abdul rehman
abdul rehman 2020 年 7 月 16 日
コメント済み: Image Analyst 2020 年 7 月 16 日
what it wrong with this code its not working,

採用された回答

Image Analyst
Image Analyst 2020 年 7 月 16 日
You need to define LastName. How should your program know what it is? It's not a built in function or anything.
  2 件のコメント
abdul rehman
abdul rehman 2020 年 7 月 16 日
can you please tell a bit of code please, thanks
Image Analyst
Image Analyst 2020 年 7 月 16 日
Try this:
t = readtable('patients.xls')
tNew = t(1:5, :) % Extract first 5 rows only.
% Get a LastName variable from column 1
LastName = tNew{:, 1}
tNew.Properties.RowNames = LastName'
tNew =
5×10 table
LastName Gender Age Location Height Weight Smoker Systolic Diastolic SelfAssessedHealthStatus
____________ __________ ___ _____________________________ ______ ______ ______ ________ _________ ________________________
Smith {'Smith' } {'Male' } 38 {'County General Hospital' } 71 176 true 124 93 {'Excellent'}
Johnson {'Johnson' } {'Male' } 43 {'VA Hospital' } 69 163 false 109 77 {'Fair' }
Williams {'Williams'} {'Female'} 38 {'St. Mary's Medical Center'} 64 131 false 125 83 {'Good' }
Jones {'Jones' } {'Female'} 40 {'VA Hospital' } 67 133 false 117 75 {'Fair' }
Brown {'Brown' } {'Female'} 49 {'County General Hospital' } 64 119 false 122 80 {'Good' }

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTables についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by