Can't generate histfit subplot (error using histfit, subscripting into a table)
4 次查看(过去 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 个评论
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 中查找有关 Graphics Object Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!