How to correct the grouping variables in splitapply ?
古いコメントを表示
Hi
Kindly see my attached function. It is a callback function for a switch button
I have already converted both my grouping variables to categorical arrrays, still I am getting the message saying: "A grouping variable must be a vector."
I dont understand what more can be and should be done to the grouping variables.
value = app.Switch.Value;
if strcmpi(value, 'on')
weightpercentages = [app.Callingapp.Osmotisk_data.Weight_percent_best_salt_1 app.Callingapp.Osmotisk_data.Weight_percent_best_salt_2];
weightpercentages=categorical(weightpercentages);
Combo=categorical(app.Callingapp.Osmotisk_data.Combinations_of_salts);
[g,id1,id2]=findgroups(Combo, weightpercentages);
hold(app.UIAxes, 'on')
splitapply(@(x,y)scatter(app.UIAxes,x,y,'filled'),app.temperature,app.Callingapp.Total_water_activity,g)
legend(app.UIAxes,string(id1) + ", "+string(id2) ,'location','northwest')
xlabel(app.UIAxes,'Temperature'), ylabel(app.UIAxes,'Water activity')
end
1 件のコメント
Stephen23
2026 年 4 月 9 日 17:45
@Muazma Ali: I notice that you have asked 134 questions on this forum, but have accepted very few of the answers that the volunteers have given you over the last few years. It is considered polite to accept the answer that best resolves your question, and is an easy way for you to show your appreciation to the volunteers who have helped you.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Cell Arrays についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!