Problema con uiopen desde GUIDE

1 回表示 (過去 30 日間)
David José
David José 2013 年 5 月 3 日
Hola con todos. espero que lean esta pregunta la verdad no suena difícil pero me tiene un día sin poder solucionarlo. Cuando cargo desde el editor mediante "uiopen" un archivo.mat se cargan las variables que el archivo contiene en el workspace, hasta ahí todo bien es decir podría trabajar con las variables cargadas. El problema esta cuando utilizo un puchbutton en guide al abrir el archivo.mat no se cargan las variables en workspace, y por lo tanto no puedo trabajar con las variables que este contiene...Si me pudieran ayudar les agradecería infinitamente... Saludos.

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 5 月 3 日
編集済み: Azzi Abdelmalek 2013 年 5 月 3 日
You can use uigetfile
[file,folder]=uigetfile('*.mat');
filename=fullfile(folder,file);
data=load(filename)
  3 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 5 月 4 日
編集済み: Azzi Abdelmalek 2013 年 5 月 4 日
Si tu mat-fichero contiene las matrices A, B y C, esto debería funcionar
[file,folder]=uigetfile('*.mat');
filename=fullfile(folder,file);
data=load(filename)
a=data.a;
b=data.b;
c=data.c
David José
David José 2013 年 5 月 6 日
Gracias amigo me faltaba cargar las variables con a = data.a ahora ya funciona todo bien... Gracias nuevamente y suerte..!!

サインインしてコメントする。

その他の回答 (1 件)

Jules Ray
Jules Ray 2013 年 5 月 4 日
por loq ue entiendo estas creando un fui que abre un archivo .mat con un botón. debes definir los handles para hacer esto, por ejemplo si tu boton se llama botón:
%% este parte del script es el callback de tu botón function boton_Callback(hObject, eventdata, handles) % hObject handle to stationsdir (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
handles = guidata(hObject) % Retrieve GUI data (the handles structure) [file,folder]=uigetfile('*.mat'); filename=fullfile(folder,file); data=load(filename)
handles.data=data guidata(hObject, handles); % Update handles structure
debería funcionar.... suerte

カテゴリ

Help Center および File ExchangeInertias and Loads についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by