Can't generate histfit subplot (error using histfit, subscripting into a table)
7 ビュー (過去 30 日間)
古いコメントを表示
My goal is to create a series of subplots of normalized histograms using an existing data table. I am working with the function histfit.
After the master data table has been loaded in, I partition the data based on columns and other categories individually, and make a new table with this information. For example.
Stained_FSCH = MasterSheet(1552:82500,1)
This Stained_FSCH specifies column 1 of the table from rows 1552 through 82500 should represent this parameter. To my knowledge, I have been specific.
When I try to run this code as instructed (for the sake of simplicity at this time and resolving this issue, I ran
histfit(Stained_FSCH)
I am met with the error . Notably, checking line 69 in any of the tables does not reveal anything unordinary, and this persists even if I run the code in a new session and matlab file without 69 lines as well
Error using histfit (line 69)
Subscripting into a table using one subscript (as in t(i)) is not supported. Specify a row subscript and a variable subscript, as in
t(rows,vars). To select variables, use t(:,i) or for one variable t.(i). To select rows, use t(i,:).
What changes do I, specifically, need to implement here? I do not think I am understanding why I am getting an error.
Thank you.
0 件のコメント
採用された回答
Star Strider
2022 年 9 月 21 日
The error is in the histfit code at line 69. That reference has nothing to do with your code or data.
The problem is likely that you are giving histfit a table as an argument. According to the histfit documentation section on data, it needs to be an array, not a table. Use the table2array function first, and histfit will likely have no problems with it.
This:
histfit(table2array(Stained_FSCH))
may run without error. (I obviously can’t test this with your data.)
3 件のコメント
Walter Roberson
2022 年 9 月 21 日
Or instead,
Stained_FSCH = MasterSheet{1552:82500,1};
Star Strider
2022 年 9 月 21 日
@Austin Davis — My pleasure!
If my Answer helped you solve your problem, please Accept it!
@Walter Roberson — Thank you. I thought of that too, however I opted for table2array for simplicity.
.
その他の回答 (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!