How to Transfer new data from app designer to matlab code?

4 views (last 30 days)
Hello together. I can't solve my problem already 2 weeks. I have a code in Matlab, which calls a App Designer window :
app.UITable.Visible = 'off'
app.UITable2.Visible = 'off'
app.UITable3.Visible = 'off'
app.UITable4.Visible = 'off'
app.VerbindungsdatenLabel.Visible = 'off'
app.KnotendatenLabel.Visible = 'off'
app.TransformatordatenLabel.Visible = 'off'
app.BezugswertenLabel.Visible = 'off'
app.DatenbertragenButton.Visible = 'off'
After that I enter data in 4 tables and I want to get 4 cell arrays in my matlab code with these new data tables after that. But i don't understand how? My matlab code can't see variables from app designer code view.
If I ad somethin like VD=app.UITable.Data in my Matlab code I get KD =[] because app.UITable.Data not existing yet.
I tried to make CallBack in Matlab code, but it doesn't working also.
function toMLButtonPushed(app, event)
Please help me. What should I do? My Matlab is 2017.

Answers (1)

NIVEDITA MAJEE on 29 Jun 2022
Hi Angelina,
You can use the following piece of code in your callback to the "to ML" button:
function toMLButtonPushed(app, event)
TableData = app.UITable.Data; %the data from the table which you want to save
[file,path] = uiputfile('*.mat');
This will allow you to write your table data in a mat file. The callback to the button will open a dialog box to save your data wherever you wish to. You can then load it to the workspace.
Also make sure to handle the situation when someone clicks on the Cancel button or tries closing the Save window using the cross button. You will get an error "Argument must be a text scalar". You can make use of a try catch block in your code.
Hope this helps!


Find more on Environment and Settings 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!