I am trying to load an excel file via GUI. The line of code i used in a regular script was:
%%Read excel file to MATLAB
% Select file from prompt (only excel, csv and txt files)
excelfile = uigetfile('*.xlsx;*.csv;*.txt;','Select event file generated by ActivPAL');
From which i later used 'excelfile' for:
TF = strncmpi(excelfile,datefile.ParticipantID,8);
PreIDParticipant = datefile(TF==1,:);
However, when implementing this in the GUI script, i get the error:
Undefined function or variable 'excelfile'.
Error in TestUI>Calculation_Callback (line 153)
TF = strncmpi(excelfile,datefile.ParticipantID,8);
When executing these commands in the command window, everything works. What is the cause of it not working in the GUI script?

 採用された回答

Adam
Adam 2017 年 3 月 6 日
編集済み: Adam 2017 年 3 月 6 日

0 投票

2 件のコメント

Arashidus
Arashidus 2017 年 3 月 6 日
When i try to open this page, it states that the site does not exist. I think you mean this: https://uk.mathworks.com/help/matlab/creating_guis/share-data-among-callbacks.html#bt9p4t0 However, this does not help me since i don't understand how the GUI stores and retrieves data. Do you know any sources which could explain the basics of GUI and callbacks?
Adam
Adam 2017 年 3 月 6 日
This link explains exactly that (I have corrected my link now, not sure what went wrong with it before). The whole page is concerned with storing and retrieving data within the callbacks of a GUI

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

その他の回答 (0 件)

タグ

質問済み:

2017 年 3 月 6 日

コメント済み:

2017 年 3 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by