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’)

endHi

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 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 splitapply, matlab, groupingvariables MATLAB Answers — New Questions

​

Leave a Reply

Your email address will not be published. Required fields are marked *