EDA365电子论坛网
标题:
Matlab 2016b “table”格式的使用方法。
[打印本页]
作者:
House
时间:
2020-4-16 13:25
标题:
Matlab 2016b “table”格式的使用方法。
本帖最后由 House 于 2020-4-16 18:19 编辑
" s+ p- x% ^% P3 |& A9 g5 z
$ j+ C/ c- F; F4 t4 E7 x
在使用Matlab 2016b的过程中发现以前没有用过的数据格式“table”,引用其帮助文件的一个示例,与各位分享其用法。
7 R& W) X7 u& M1 [ n+ s" P" u0 m
% Create a MATLAB table named patients from workspace variables.
load patients;
BloodPreasure = [Systolic Diastolic];
patients = table(Gender,Age,Smoker,BloodPreasure);
patients.Properties.RowNames = LastName;
% Sort the table based on the Age variable.
sorted = sortrows(patients,'Age');
% Create a report with the sorted patients table
rpt = mlreportgen.dom.Document('MyFileName','pdf');
append(rpt,sorted);
close(rpt);
% Show the PDF report in the viewer
rptview(rpt.OutputPath);
( f& k3 e+ C$ M
; N! k! m l! P
3 Q6 U: B$ Q' F0 {$ K& D% u
其中生成的patients即为table格式文件,调用数据方法为patients.BloodPreasure(1,: ),可以调出血压的第一行数据,以此类推。
/ X0 }, P$ z/ h) z
作者:
gaoxings
时间:
2020-4-16 18:18
Matlab 2016b “table”格式的使用方法。
欢迎光临 EDA365电子论坛网 (https://bbs.eda365.com/)
Powered by Discuz! X3.2