my app designer app having anova1 (statistical toolbox) works perfectly while matlab is open, but it doesn't work as a standalone(.exe) application after deployment.

2 visualizzazioni (ultimi 30 giorni)
my app designer app which has anova1 (statistical toolbox) works perfectly while matlab itself is open, but it doesn't work as a standalone(.exe) application after deployment. It gives an "error in anova1" line written in the command prompt. Everything in the app is working fine except anova1 tool. (Matlab R2022b). Any help about it? I checked the build-in functions which are not supported to use in app designer but anova1 is not in the list.
%% Statistical Analysis (ANOVA) & Plot
% app.StatisticsDropDown.Value is an input (gui) from the user, which
% data should be selected for anova analysis thorugh drop down
% menu. That code work in app designer while matlab is open.
if strcmpi(app.StatisticsDropDown.Value, 'Option1')
[~,~,stats] = anova1(MyMatrix1, MyMatrixGroupName1);
[c,~,~,gnames] = multcompare(stats);
tbl = array2table(c,"VariableNames", ...
["Group A","Group B","Lower Limit","A-B","Upper Limit","P-value"]);
tbl.("Group A") = gnames(tbl.("Group A"));
tbl.("Group B") = gnames(tbl.("Group B"));
app.UITable_Stat.Data = tbl;
app.UITable_Stat.ColumnName = tbl.Properties.VariableNames;
app.UITable_Stat.RowName = tbl.Properties.RowNames;
elseif strcmpi(app.StatisticsDropDown.Value, 'Option2')
[~,~,stats] = anova1(MyMatrix2, MyMatrixGroupName2);
[c,~,~,gnames] = multcompare(stats);
tbl = array2table(c,"VariableNames", ...
["Group A","Group B","Lower Limit","A-B","Upper Limit","P-value"]);
tbl.("Group A") = gnames(tbl.("Group A"));
tbl.("Group B") = gnames(tbl.("Group B"));
app.UITable_Stat.Data = tbl;
app.UITable_Stat.ColumnName = tbl.Properties.VariableNames;
app.UITable_Stat.RowName = tbl.Properties.RowNames;
end
  5 Commenti
Serhat Aydin
Serhat Aydin il 22 Ago 2023
Modificato: Serhat Aydin il 23 Ago 2023
Although it is working but just in case, I removed the if condition and dropdown menu option from the code by leaving just anova1 in the end, still getting the same error. Everyhing is executable until that line of code. Anyways, Thank you all! I will keep trying!
Update: I had to copy and paste the source code (.m) files and their associates function files (anova1 + (statdisptable, fpval) with multcompare) from the path (toolbox>stats) into my application folder. Then I compiled/deployed the application main file with those files required for the standalone app to run. Now it does work perfectly fine as it does in matlab.
Tips: if unrecognized function or variable is received, bring the function used in the code into the current folder that the app file in and compile with them together.
Walter Roberson
Walter Roberson il 23 Ago 2023
Copying toolbox code into the path can result in code that will not execute, either because MATLAB complains about the license, or because the code relies upon details of the file structure.
Either use the %#function pragma or use the mcc -a option or use the graphic options of the application compiler to list the additional files.

Accedi per commentare.

Risposte (0)

Prodotti


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by