Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
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 comentarios
Andrew Cuaki
Andrew Cuaki el 22 de Feb. de 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.

Iniciar sesión para comentar.

Respuestas (2)

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

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by