Azzera filtri
Azzera filtri

I am trying to use a button to open another app window but an error keeps popping up

1 visualizzazione (ultimi 30 giorni)
i am trying to create an app that when a button is pressed, opens up a separate app window where the user will then fill in data but when i try this code: open(FILE_NAME) this error:"File or variable name must be a character vector or string scalar" appears
  2 Commenti
Andrew Cuaki
Andrew Cuaki il 22 Feb 2022
i created another .mlapp and tried to open it using the open command, the error pops up and it redirects me but once i go back to the app it proceeds fine. i tried using this: open("FILE_NAME") and it worked with no errors but it redirected me to the editor and when id go back to the app it just terminates.

Accedi per commentare.

Risposte (2)

David Hill
David Hill il 22 Feb 2022
Below shows a simple structure for what I think you want to do.
function GUI()
fig = uifigure;
p = uipanel(fig,'Position',[20 20 196 135]);
File = uieditfield(p,'Text','Position',[5 60 190 50],'Value','File Name');
btn = uibutton(p,'Position',[5 5 190 50],'Text','Open','ButtonPushedFcn', @ButtonPushed);
function ButtonPushed(~,~)
r=readmatrix(File.Value);%not sure what kind of file you are reading/opening
end
end

Cris LaPierre
Cris LaPierre il 22 Feb 2022

Categorie

Scopri di più su Develop Apps Using App Designer in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by