フィルターのクリア

Reading and renaming a variable from .mat file in appdesigner

4 ビュー (過去 30 日間)
Anum Ahmed Pirkani
Anum Ahmed Pirkani 2020 年 8 月 17 日
回答済み: Anum Ahmed Pirkani 2020 年 8 月 17 日
Hello,
I am facing a problem in appdesigner while loading a variable from the previously saved mat file.
I can load the .mat file in the appdesigner using load(file.mat).
This file.mat containes several variables and I need to access and rename one of the variables (this variable be used for further processing).
User enters the name of variable which needs to be renamed to another variable.
I have tried various approaches but whatever I do, a structure is formed from the variable name user enters with the variable of original file.mat in it.
load(app.FileName.Value) %File.mat which will also be entered by the user
DataProcessing = app.VariableName.Value; % The variable I need to access in File.mat
Any help in this regards would be highly appreciated.
Regards
Anum

採用された回答

Stephen23
Stephen23 2020 年 8 月 17 日
編集済み: Stephen23 2020 年 8 月 17 日
It will be much simpler if you load into an output variable (which itself is a scalar structure):
S = load(app.FileName.Value);
Data = S.(app.VariableName.Value);

その他の回答 (1 件)

Anum Ahmed Pirkani
Anum Ahmed Pirkani 2020 年 8 月 17 日
Thanks a lot Stephen, it works now....

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by