I have a file name 'partOneData.mat how do I load the data and create a histogram from Matlab.
3 ビュー (過去 30 日間)
古いコメントを表示
I have a file name 'partOneData.mat how do I load the data and create a histogram from Matlab.
I have this but it does not seem to work close all;
commandwindow;
%loads mat file
a = load('partOneData.mat');
figure;
hist(a);
2 件のコメント
Adam Danz
2019 年 1 月 10 日
What doesn't it work? Are you getting an error message? If yes, please copy and paste it here; if no, please specify what's wrong.
I'm assuming the variable you're trying to plot is named 'a'.
Lastly, if you're using a more recent version of matlab, use histrogram() instead of hist().
採用された回答
Adam Danz
2019 年 1 月 10 日
編集済み: Adam Danz
2019 年 1 月 10 日
First read about the output to the load() funciton:
The output is a structure containing fields for each variable in the file.
Suppose the variable you're trying to plot is named 'data'
a = load('partOneData.mat'); %'a' is a structure
figure
histogram(a.data) % 'data' is the name of the variable you're plotting
Also see this example:
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Distribution Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!