You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
Run script file from App designer
9 views (last 30 days)
Show older comments
I succeed in run my script file from the app designer but the problem is, it runs in command window and when I ask to show result it shows the old one on the workspace
13 Comments
Ayman Shaban
on 10 May 2022
Actualiy I'm using functions and call them in these scripts, I don't know if I can call func in func !
Ayman Shaban
on 11 May 2022
ok, I did that but I stil have the same problem, app designer give me error because it can't find 'result' in the workspace to show it in the editfield
cr
on 12 May 2022
In the function where you are computing the result, copy it to main workspace using eval(). e.g. if result is a scalar, eval(['result=' num2str(result)]). This would make the variable available in main workspace. Another way is to use global variables.
Note that both these are less efficient ways of dealing with variable scopes.
Ayman Shaban
on 12 May 2022
% Button pushed function: ResultButton
function ResultButtonPushed(app, event)
TestPenchCode3 %calling function
Result = evalin('base' , 'ans');
app.EditField.Value = Result;
end
Ayman Shaban
on 12 May 2022
@cr The result is like, 'this case is healthy' or 'patient'
Rik
on 12 May 2022
You should edit your function so you can actually retrieve the output and call it like this:
% Button pushed function: ResultButton
function ResultButtonPushed(app, event)
Result = TestPenchCode3; %calling function
app.EditField.Value = Result;
end
You never need to use eval.
Ayman Shaban
on 12 May 2022
@Rik Thank you so much, it's done.
Ayman Shaban
on 12 May 2022
I have another Q, I'm working on matlab code for detecting speech disorder, I've five classes each class is 220 sounds, so I use calssification learner in matlab with some features(statistic features, spectrm and MFCCs), The problem is that the accuracy of classifier is weak (about 75%), do you know how I increase it.
Ayman Shaban
on 13 May 2022
I'll open a new question
Thank you my friend
Answers (0)
See Also
Categories
Find more on Develop Apps Using App Designer in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)