Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
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 Kommentare
Andrew Cuaki
Andrew Cuaki am 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.

Melden Sie sich an, um zu kommentieren.

Antworten (2)

David Hill
David Hill am 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 am 22 Feb. 2022

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by