Doug's MATLAB Video Tutorials

Video series: Reading Excel data into MATLAB with a GUI 87

Posted by Doug Hull,

I had a chance to work with a MATLAB user that was interested in bringing her Excel data into MATLAB and plotting different variables. This was a fairly standard file format, just columns of data. It was pretty easy to read in the data with XLSREAD:
Note that three minutes into the video above, I use a neat cell mode trick that many might not know about. Once this was done, it was time to turn that script into a function so that it could be reused easily.
Finally, the function needed a GUI to make it easy to view any piece of data from the file.
The original data file, and all the files created during the movies are located with the movie files. (Data file posted with her permission) Read the Excel data Refactor to script into a function Build the GUI

87 CommentsOldest to Newest

Hello,

the “Build a GUI” video is quite helpful.
For further videos, I propose to use a larger Matlab window (in particular width). Then I can see the whole line and do not have to switch to the source code.

Thanks

Gerd,

I completely agree that it would be nice to see the entire command line. The trade-off I am struggling with is I can only make the screen so wide if I want to embed the video in a web page. I could zoom out, but then the text is illegible.

I will try to use …
short commands or …
the commands can be …
continued like this …
so they all fit on …
screen at once.

If anyone has any other ideas, please let me know. I can make the videos taller and fit in the blog, but 500 pixels wide is all that fits nicely here (that is still 180 more across than I could get on YouTube)

Thanks,
Doug

Great videos Doug!

I got a problem when reproducing the Excel-plotting GUI… I guess I am missing something so the outcoming GUI stands by itself fine.

Here is what it happened:

While I was running the GUI from GUIDE or its M-file, everything was ok. When I opened MATLAB again (during a new session) and clicked the .FIG file on the Current Directory Window, the GUI appeared, but it started to produce the following errors:

—————–
handles =

fileName: ’070924bgzFake.xls’

??? Reference to non-existent field ‘popupmenuX’.

Error in ==> PlotExcelGUI>pushbuttonLoadXLS_Callback at 140
setPopupmenuString(handles.popupmenuX, eventdata, handles)

Error in ==> gui_mainfcn at 95
feval(varargin{:});

Error in ==> PlotExcelGUI at 42
gui_mainfcn(gui_State, varargin{:});

??? Error using ==> PlotExcelGUI(‘pushbuttonLoadXLS_Callback’,gcbo,[],guidata(gcbo))
Reference to non-existent field ‘popupmenuX’.

??? Error while evaluating uicontrol Callback

—————–

How can I make the .FIG file to run my GUI without getting into GUIDE each time?

Thanks. And again, great job for those videos!

Mauricio

I tried downloading the mainGui.fig, mainGui.m and the excel file so I can run it, and the gui came up just fine, but once I selected the excel file, I got some callback errors:

?? Reference to non-existent field ‘popupmenuX’.
Error in ==> mainGui>pushbuttonLoadXLS_Callback at 130
setPopupmenuString(handles.popupmenuX, eventdata, handles)
Error in ==> gui_mainfcn at 75
feval(varargin{:});
Error in ==> mainGui at 42
gui_mainfcn(gui_State, varargin{:});
??? Error while evaluating uicontrol Callback.

Any ideas?

Mauricio and Richard,

To run this GUI, you should run the .m file, not the .fig file. The .m file contains a lot of important initialization code that should be run.

Doug

Hi Doug,
Thanks for the prompt replay. I’m gonna ping you on something that I’m having a great deal of difficulty with. And that is, I have a text file pretty much the same format as the excel example you have. The first row is the header row (string) that specifies the names for the columns (numbers). How can I adapt your code to my needs? My goal is to come up with the gui that gives you the option to pick and choose which columns go to x and y, just like you have in your example. I think the key difference is knowing what ‘xlsread’ actually does. I’m using ‘textread’, but the real problem is the first row is a string, which ‘textread’ won’t read in. I can get ‘textread’ to read in the first column strings, but then I’ll need a separate ‘textread’ to read in the rest of the numbered data. Do you see how it complicates things?

Thanks,
Richard

Hi

Thanks a lot to you Doug Hull, I have learned a lot about MATLAB specially GUI by your video.

I am from very distance area but I am very interested in MATLAB.

In few words I am a big fan of yours

thanks again

FFA

[minor typos corrected, Doug]

Hi
Thank you very much for your videos, I am a final year electrical engineering student and your videos have helped me produce MATLAB code that will be really useful in compleating my final year project.

many thanks
Trevor

Hi,
I have a similar question about importing excel data into matlab, but about a more complicated type of file. My excel files has a lot of text near the top, and then many columns of data with x-y-z locations for 3-D points. After ALL of this data, there’s some more text, and then EMG data. I want to write a function to read through past the text, find the columns of data I’m interested in, and store them in their own variables. Do you know how I would go about doing this?

Maryam,

This is getting into reading custom formats inside of an Excel file. MATLAB gives you the ability to read an arbitrary range inside of an Excel file, and the ability to parse those results. These are the low level functions that are need to accomplish this goal. There is no built-in function that will do what you want since files can vary so much. However, you should be able to build your own.

Doug

Is this code will face problems if it used in matlab 6.5 ? because that happen to me
I mean the code used to read from excel files ..

Thanks

I want to know if it is possible to write data into an excel files using GUI Matlab program ??
Right now I am going to develop a big program that takes data from first users and make several kinds of calc as an output … excel file it is suppose to store these results (by Matlab supervision of course)… and for other users it is should to review latest results , makes same calc and then makes it is Owen results in different excel files …..
Is there any advice U can give me here?

Farasha,

I developed this code in 2007a. I just tried it in MATLAB 6.5, but it seems that XLSREAD was improved since then and this code does not work in 6.5.

For your second question, yes, you can write out Excel files. This functionality has been introduced since 6.5. You will likely want to upgrade to take advantage of these new features.

Doug

Hi,

My question is can i run an m file from excel sheet? i know i can read data from excel sheet and do calculations in matlab and then return the data to the excel sheet but this requires running of the m file. I am in the process of developing a userfriendly software and i feel combination of excel with VB will be more fit for the purpose. Please do reply.

regards
sivapriya

I am trying to plot data in 3D. I have degrees for axis 1 across the top, degrees for axis 2 down the side, and the data (which will be the Z-axis) are what is in the matrix. How do I modify the mainGUI to incorporate x,y, and z and recognize that there isn’t a “heading” for the column 1 since that is actually one of the axis and not the data itself.

Thanks,
Jason

Jason,

This is quite a bit different from the GUI that I have here. I think you would be best served to start a new one with the knowledge you have gained in making this one.

I am not sure I understand the last part of your question. You might be better served by asking this of tech-support:

http://www.mathworks.com/support

Doug

Dear Doug,
I would like to merge data files from a few .xls files in one .mat file. Since in .xls file the max no. of column is 256 but I need 600 columns for my input data. That’s why I split data in few .xls files. I know that I can do it by cut and paste the data in .mat file but it will be time consuming. Is there any other way to do it? Please help. Thanks

regards,
Izzri

Izzri,

You can read in from several files and then concat the variables together:

a = **read file**
b = **read file**

c = [a b];

Enjoy,
Doug

Dear Doug Hull,
Hi!
I have seen your tutorials and I have to admit that I have learned a lot thanks to your efforts.
While watching the tutorials I noticed that there aren’t any which covers the table component to be used as UI in order to collect and save editable data in a file in order to eliminate the dependency of Excel. I have tried to search for a hint but failed to find any which helps. I wonder if you are kind enough to show likes of me a hint on how to save editable data from a table to a file and then load it back to the table.
Respect,
Hamid

Doug,

I have no trouble reading in files, manipulating the data and plotting. My trouble is I want to do this with quite a few data files.

Is there a way to run through all the files in a folder or directory without inputting the file names manually? Can you help me automate this process?

A.K.A.
1) I want to open a file in a folder
2) Read the data into MATLAB*
3) Manipulate it *
4) Open the next file in the folder and repeat

Hi Doug, thanks for your video about reading an Excel file from Matlab. I am pretty new to Matlab but I have been presented with a project to work on that I think Matlab will help with.

I have an Excel sheet with a lot of data that I need to make searchable for specific user-defined values. (I was thinking of putting in some user prompts). It seems like xlsread reads the entire Excel file, or a range of cells in the file. For my purposes I will only need to read one or a few cells at a time. Then I need to load a DLL for a data analysis program I have (I was thinking about using the Matlab Generic DLL Interface), and call specific functions to operate on the data, and then I was thinking about using xlswrite to print the results to a new worksheet or to the next page within the same Excel file.

For example, I run the program and I happen to be interested in Temperatures between 95 and 100. So I search for all of these values that might be in the Excel file, then let’s say I have a function in my DLL file called TEMP2. I would call that function and use it to process these temperatures.

Do you think I am on the right track? Could you possibly help me figure out how I can accomplish this?

Thank you.

Thanks Scott, I will probably send you an email.

Basically what’s hard for me is wading through the syntax when first starting out, it’s not obvious to me what certains commands do unless I can see an example of where it is used.

I am pretty good at adapting examples to my specific problem.

The main concerns I have is that the DLLs I have won’t be compatible with the Matlab DLL Interface and I’ll end up using a Fortran script (which is originally what the data software people recommend, but what do they know about Matlab?)

Hi Doug,
Following your fantastic tutorial, I try to create a GUI bringing my Excel data and doing some calculations. My excel file has 20 worksheets(20 subjects), and each worksheet has data. These are part of my code:

setPopupmenuString(handles.popupmenu1, eventdata, handles)

function setPopupmenuString(hObject, eventdata, handles)
fileName = handles.fileName;
[tpe, xlSheets] = xlsfinfo(fileName);
set(hObject, ‘string’, xlSheets);

It updates all sheet names on popup menu. Then I want it automatically updates data when I select different name from popup menu. So my question is how to get data from each sheet? I tried “get(handles.popupmenu1, ‘value’)” but it doesn’t work.
Any help will be highly appreciated! Thanks.

Henry,

It is not clear to me the specific question you need answered. I think you have a pop-up menu that is correctly populated with the various sheet names from your Excel file. From there, you want to figure out the name of the sheet that was selected in the pop-up.

Value will give you an ordinal number. You need to then use this number to index into the cell array that is stored in the ‘string’ property to get the actual string that represents the sheet name.

Doug

hi,
I have a question
I have a matlab code and i want to read a data from SQL server database to use it in that code

so i want to know if i can read this data? if yes, how can I do this ?

Best Regards,
Maram

Look this is a great video but for a person totaly new to MATLAB there is a big problem in this tutorial. You need to identify what each code means. you say something like: setPopupmenuString(handles.PopupmenuX, eventdata, handles) what is setPopupmenuString? what are handles? setPopupmenuString (you never explain what is needed in here, what does it mean? Why you need it?)

the first two videos are fairly easy to understand but the last one is abit confusing because I did not know what code to start with. I think you should explain in more detail why you should type this code? what does it does? one after every line. thanks

btw how do you get filename if the file I wanted to get does not have any suffix? Can I do it this way?
–> fileName = uigetfile(‘*’)

Hi Ive tried the same method used for unidentified files witout any suffix and I failed. What modifications to the codes you need to do for an unidentified file to get the same result as this tutorial?

Hello “MATALB Newbie”

There is always the difficult decision on how much detail I need to discuss in a video. This third video was already 13 minutes, nearly three times the average length. Sometimes, details need to be skipped.

There are plenty of other video that discuss the questions you have, like what is “handles”

http://blogs.mathworks.com/videos/2008/04/17/advanced-matlab-handles-and-other-inputs-to-guide-callbacks/

You can see all the GUI videos here:

http://blogs.mathworks.com/videos/category/gui-or-guide/

Doug

Hi

My current version of MATLAB is 7.6.0 R2008a can it read Microsoft Excel 2007? i.e. .xlsx instead of .xls. If it is possible, what changes must I make to the xlsread code?

regards

MATLAB newbie

“Newbie”,

Have you tried this? It worked for me without issue, so I assume yours did not work. What was your code?

Doug

fileName = ’1.xlsx’

fileName =

1.xlsx

>> a = xlsxread(fileName)
??? Undefined function or method ‘xlsxread’ for input arguments of type ‘char’.

Hi

Do you have a video that teaches you to write a program that automatically creates an excel file and writes data into that excel file once you execute the program?

Hi Doug,

I have recently built up a GUI which has multiple functionality of downloading Documents from an ftp server, listing dir and opening local files. what I want to do next is include a window on the GUI where I can load an excel sheet on it. i.e. have GUI like a remote desktop for that spreadsheet where I can modify/change/save…ect the data.

I have managed to add Microsoft office spreadsheet 11.0 activeX, but when implementing it within the GUI, it doesn’t ask me for which spreadsheet I want to open instead it loads a blanc one and everytime I export the data to Mic Off excel it saves it automaticaly under a different excel file.

I can open the file with the following matlab commands but I can’t really manage to link it to open within the GUI:

excel = actxserver(‘Excel.Application’);
file = excel.Workbooks.Open(xlfile);

It would be great if anyone can help.

Thanks.

Amine,

The documentation on how to interact with actX controls is with the maker of the control, so there is not much I can do to help you here. I would check with the maker of the control to look for documentation on it.

Doug

@”MATLAB Newbie”

xlswrite will do what you are asking for.

a = magic(3)
xlswrite(‘foo.xls’, a)

Hi Doug,

I really like the style of your Matlab tutorials!!

A question: in the GUI you created I’d like to be able to select multiple values from the pop-up menu and plot them on the same graph. How can I alter your code to do this??

Many thanks

Lucy

@Lucy,

Thanks for the kind words. You can only select one value from a pop-up. Change it to a list box and change the MAAX property (weird, I know) so it is multi-select. The rest would be a matter of changing the plotting code to deal with all the selected values.

Doug

Hi,
I am trying to export a ‘figure’ and some Numerical data into excel. I first save’figure’ using ‘activx’ and then I write numerical data using ‘xlswrite’. but everytime matlab overwrites the existing data in excel. Is it not possible to write both figure and data with just matlab commands(without installing any other tools)? Please help.
thanks.

@ros,

Are you always using the same filename for Excel? That is why it is overwriting maybe. If you are using the same file name, what do you want to happen?

Doug

Thanks for your reply.

i want to use same filename. and i want to write one figure and under that some numeric data. If i write figure first using activx and then use xlswrite to write numeric data then figure is gone and only numeric data remains and vice versa.

….and i do not know following things:
1)how to write a fig in excel using xlswrite
2)how to write data in excel using activex commands.

Hi Doug,
I am trying to open a Excel file which has multiple sheets. I can use winopen command to open any file in MATLAB. But how could open a specific work sheet?

If anyone could answer this, it will be very helpful. I am looking for a quick win.

Thanks!

If I added a second axes on the GUI, how would I implement the code to plot two different graphs on the same GUI? Both plots are coming from the data that is read into Matlab from excel, just like the tutorial shows. I just want to be able to produce two plots in one GUI.

@Aaron,

What have you tried. Where is the stumbling point? Adding a second axis, are both plots going to the same axis? You should capture the handles from each axes and use them as inputs into the plotting functions.

Doug

It seems the same plot ends up on both axes. I tried to implement a plot axes pushbutton for both axes. This is what I have for code under the plot axes pushbutton.
function PlotAxes1_pushbutton_Callback(hObject, eventdata, handles)
% hObject handle to PlotAxes1_pushbutton (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
fileName = handles.fileName;
axes(handles.axes1)
[x,y] = readExcelcolumns(fileName, xcolNum, ycolNum)
hold all
plot (handles.axes1, x,y)
axis ([320 400 0.760 0.900])
guidata(hObject, handles)

This plots on both axes. When I try the next function plot axes2 pushbutton it does not seem to plot the data into axes2. The axes1 data plots in both axes1 and axes2

I am not sure if this is the right approach.

@aaron,

I think I must not understand you. I think you are saying that the above code puts the same plot on two different axis. The above code would not do that though.

Please contact tech support, http://www.mathworks.com/support and they can help you better.

Doug

Hi Doug, thank you for your videos, they really help!

Today I follow your example here, when I copy and paste the callback of push button from inspector, it gives me this:

DataPlot(‘pushbuttonLoadData_Callback’,hObject,eventdata,guidata(hObject))

when I run, it says something wrong with hObject.

then I change the hObject to gcbo, change eventdata to [], it works perfectly.

Would you like to suggest any reason could lead to such a problem?

My matlab version is 2011b.

thank you very much!

@Joshua,

It is not clear to me what you are attempting to do, but I think that you are copying from the property inspector and that was not covered in the video. It is too much to explain in a comment though.

Doug

Hi Don
I have the same problem as Josua

Today I follow your example here, when I copy and paste the callback of push button from inspector, it gives me this:

mainGui(‘pushbuttonLoadXLS_Callback’,hObject,eventdata,guidata(hObject))

when I run, it says something wrong with hObject.

then I change the hObject to gcbo, change eventdata to [], it didn’t work.

What should I do here?

My matlab version is 2012a.

thank you very much!

Hello Mr.Hull,

I am a newbie to programming and have chosen MATLAB to start with. I want to make MATLAB a better alternative to Excel for my research purposes. Your videos are helping me finding a way through. Thank you for that!

I have to generate graphs from several (thousands) of CSV files generated from simulation runs. These CSV files have yearly-hourly values of different variable such Air temperature, humidity, etc. That means in one file I usually have to deal with 8760 rows (for no. of hours in an year) and many columns. And when the files are in thousands of number, then I have a huge data to process.

I have two questions from you, which are:

1.The first column array of the CSV file is in Date-Time format e.g. “01/01/2012 01:00:00″ and so on. When I import this file into MATLAB it separates this Date-Time column from the rest of the data, and treats it as a text data. So how can I plot a graph between this Date-Time column and the other data columns. Do I have to convert this date-time values into numeric values and then bring it to MATLAB, but then I have to match between year 1900 date-time format of csv and year 0000 date-time format of MATLAB. What is the best way to deal in such situation?

2. How to deal with multiple files since many times I have to plot graph between column arrays from different files?

I would appreciate, if you can give some momentum to my programming learning.

Thank you!
Vaibhav Jain

PS: I can send you a copy of the CSV file, if you wish to look into it. Please let me know how I can send it to you.

Hi Doug!
For some reason when I’m trying to xlsread a specific range of rows and columns from he exel file, I get the following error:
Warning: Could not start Excel server for import, ‘basic’ mode will be used. Refer to HELP
XLSREAD for more information.
> In xlsread at 186
In exelDTV at 1
Warning: Range cannot be used in ‘basic’ mode. The entire sheet will be loaded.
> In xlsread at 199
In exelDTV at 1
Where exelDTV is my assigned variable. I tried looking at row 186 and changing value of ‘Basic = true’ to ‘false’ but it didn’t work,I just get more errors. The help section says that I cannot use range command unless I have a machine running Windows OS with exel installed on it, which I do. Is there any way to fix this issue?

I also have this problem that a couple of people here seem to have. When I copy the callback from property inspector I get an error that says that ‘Undefined function or variable ‘hObject’.’ For some reason your callback string has ‘gcbo’ instead of my hObject and [] instead of my ‘eventdata’. What could be the reason for this? Matlab version is 7.14.0.739 (r2012a)

@Glen,

What platform are you on?

As stated in our documentation: The full functionality of XLSREAD depends on the ability to start Excel as a
COM server from MATLAB. If your system does not have this capability (as on a non-Windows platform
such as a Mac or Linux machine), the XLSREAD syntax that passes the ‘basic’ keyword is recommended.
As long as the COM server is available, you can use XLSREAD on Excel files having formats other than
XLS (for example, HTML).

Hi!!
I am new to MATLAB and really the Video Tutorials helps a lot in understanding GUI feature of it.
Question:I had followed all the above steps and when I run .m file, figure window opens and I loaded Excel file but when I came to choose the column to plot following error is occurring.Can you please tell me where is the problem..??
Following is shown in command window::
handles =

figure1: 153.0017
pushbuttonLoadExcel: 1.0020
popupmenuY: 0.0021
popupmenuX: 159.0018
axes1: 154.0017
output: 153.0017
fileName: ‘project1 – Copy.xls’

??? Reference to non-existent field ‘filename’.

Error in ==> main>updateAxes at 145
fileName = handles.filename;

Error in ==> gui_mainfcn at 75
feval(varargin{:});

Error in ==> main at 42
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback.

>>
Regards
Kavita

Hi Doug
Sorry, I was not too specific. The weird problem is that I am using Windows XP 64 bit with Excel installed on it. I asked my system administrator if Excel is running virtually, but this seems to be not the case. What could be the issue? I tried reinsalling excel already. Really need help here!!

@Glen

Please contact support, I don’t think I can answer this efficiently here, but they can.

@Kavita

fileName ~= filename

Check capitalization.

Doug

Doug,thank you so much for all your help, you are literaly doing god’s work! But I’ve got another issue. I tried compiling that software we created in this tutorial and everything works fine until I upload an excel document-nothing hapens. It’s as if the excel document is not stored in the program. How can I fix this problem? Again,sorry for being so annoying with all those questions!

Doug,
I am not 100% sure what you mean by that, but here’s what my file selection process looks like:
I have an .xls file in folder ‘A’
I compiled the script and put it in a folder ‘B’
When I launch software,everything seems to work fine, but once press load.xls button, find the file and select to open it, nothing happens. The files I compiled were:
Main file> .m file we created
Additional file> .fig file with the gui layout and my background picture.
I tried doing it on 2 different computers and even created a different function with uigetfile command in it, and the issue is always the same. It seems like uigetfile command is not supported by compiler or some important files are missing. Thanks for your help!!!

Doug,
Nevermind my last post, I figured out what you meant by your previous answer, everything works well now! Thank you very much for your great tutorials and answers!

Hello Doug!
I am working developing a GUI, i have to take a excel file, and do some plots, OK so far no problem, but I would like to be able to take the excel file from a different folder which is always random, With uigetfile I can only get the file in the same folder that I am. I see that is a similar problem than the @Glen, but he does not say what the solution is.
i will appreciate your help a lot, even if you want I can send you the script.
Thank you very much!!

Yes sorry, i didn’t explain it very well. when I pres the button LoadXLS it opens a window, if i have the excel file in that window the GUI works perfect. But if I have to take the excel file from another folder,I can change the folder, but when i select the file I have this error:

setPopupmenuString (line 90)
[numbers , colNames] = xlsread(fileName);

Error in TempEstimationCapacitorGUI>pushbuttonLoadXLS_Callback (line 84)
setPopupmenuString(handles.popupmenuY, eventdata, handles)

Error in gui_mainfcn (line 96)
feval(varargin{:});

Error in TempEstimationCapacitorGUI (line 42)
gui_mainfcn(gui_State, varargin{:});

Error in @(hObject,eventdata)TempEstimationCapacitorGUI(‘pushbuttonLoadXLS_Callback’,hObject,eventdata,guidata(hObject))

Error while evaluating uicontrol Callback>

Is searching the file in the current folder, not in the folder that I want.

Thank you!

Sorry part of the beginning error message was lost :

setPopupmenuString (line 90)
[numbers , colNames] = xlsread(fileName);>

Error using xlsread (line 129)
XLSREAD unable to open file ‘Winter.xlsx’.
File ‘E:\etsia\proyecto\experimentos\experimento delta\WSN\Winter.xlsx’ not found.

xlsread neads the complete path to that file.

[FileName,PathName,FilterIndex] = uigetfile(FilterSpec)

You can get it from the other outputs of uigetfile. You might need filesep and fullfile to get the full filename.

Hi, wonderful video. I would like to request a part IV that feature show to turn that wonderful GUI into a stand alone executable. Thanks for doing these.

Sir,I am unable to dump the contents of excel sheet into the uitable created in GUI.*I am using data from excel sheetes to write matlab programs. Also I have crating a GUI containing all the program codes. But i want to display the data in a uitable from the excel sheets and I am unable to do it. I have wriiten the following code

f = figure(‘Position’, [200 200 400 150]);
dat= rand([10,3]);
cnames = {‘Actual’, ‘Forecast’, ‘Error’ };
rnames={’1′,’2′,’3′,’4′,’5′,’6′,’7′,’8′,’9′,’10′}
t = uitable(‘Parent’,f,’Data’,dat,’ColumnName’,cnames,’RowName’,rnames,’Position’,[20 20 360 100]);

From the above code table is created in a new figure with specified rows and columns. But the entries contains some redundant data and i havent provided any path to excel. I don’t want to use ‘rand’command which grenerates redundat data while I want to store excel sheet contents in uitable.How can I do this?

Hello Doug,

Pretty helpful video. However, I have one question which I hope you could clarify. I am using my GUI to load 2 different excel files and then plot different plots using the data loaded for the comparision purposes. So when I upload one “.xlsx” file, it plots whatever I want using the GUI. Then when I upload my second “.xlsx”file, it plots every parameter I want to. However, the problem which I am facing is that now if I use the pop-up-menu of my first .xlsx file to plot a new or different plot, it doesn’t work and shows me an error in calling the “readExceldata” function. Thus, the problem is that if I load a new excel file using the push-button, I am unable to gain access to the previous loaded excel file and I need to load it again for accessing it. I have used different callback funcitions for both push-buttons and hence, have different fileNames. I am unable to understand why is this haapening. Any guidance is highly appreciated.

Thanx.

Shashank

Hello Doug,

In the 3rd video you have explained how the data in the excel file can be used through out the GUI using the sytax guidata(hObject, handles). What do we need to do if we have two excel files? or some other thing which even should be available through out the gui?
Is this possible? If so how can this be implemented. Looking forward for the answer.

Hello Doug,

I tried your code for the Gui, but pop up menus didn´t show the column names.
I added then set(handles.popupmenux,’string’,colNames);
set(handles.popupmenuy,’string’,colNames); after that Popupmenus show the colnames.

But I can´t figure out why it should not work for me

Add A Comment

What is 4 + 10?

Preview: hide

These postings are the author's and don't necessarily represent the opinions of MathWorks.