フィルターのクリア

How to avoid clearing workspace in MATLAB App button ?

4 ビュー (過去 30 日間)
Kaustubh hike
Kaustubh hike 2021 年 8 月 23 日
コメント済み: Stephen23 2021 年 8 月 23 日
Hi,
I have existing variables in matlab worksace.
I am creating on app in which there is Button. If I click button then all workspace variables get erased .
How to avoid erasing of these workpace variables ?
The app works on the worksspace data.
  3 件のコメント
Kaustubh hike
Kaustubh hike 2021 年 8 月 23 日
I want it should work on matlab workspace .
I have simulation results in matlab workspace .
and want to do some operations on that data by using app.
Stephen23
Stephen23 2021 年 8 月 23 日
"I want it should work on matlab workspace."
Every workspace in MATLAB is a MATLAB workspace.
Did you read the links that I gave you? They explain the basics about different MATLAB workspaces.
The best solution by far is to pass the data to your app and process it within the app workspaces. Is there any particular reason why you cannot use the best approach, but instead need to use a slow, complex, buggy approach to accessing your data?

サインインしてコメントする。

採用された回答

Adam Danz
Adam Danz 2021 年 8 月 23 日
> I want it should work on matlab workspace .
Bad idea. This defeats the purpose of an app which is to allow users to interact with data from the app rather than requiring users to manually create and manipulate data in an independent workspace. That approach is not reproducible and very prone to error.
Whatever variables that are in the external workspace that belong in the app should be loaded directly to the app and stored as private or public properties (also see documentation).
  • Where do those variables come from? If you're loading a mat file or reading a data file, do that directly within the app.
  • If the file source is to be selected by the user, include an app component that allows the user to select the file (see uigetfile).
  • If you're manually defining variables and variable names in an external workspace and the app needs those variables, you have to rethink that process and create a way for users to enter parameters directly within the app so the app can do that work within callback functions.
The solution involves reworking the workflow. If you run into a problem implementing those changes, specificily explain the source of the data, the workspace the data exists in, and explain why that isn't being done within the app.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by