Stuart’s MATLAB Videos

Watch and Learn

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Building a GUI to read, modify and write an Excel file. 4/4 20

Posted by Doug Hull,

This is the fourth in a series of videos that will go through the process of planing and implementation of a simple GUI. Realistically, I would not plan out a GUI this simple, but the idea is to show what my planning process is on a simple example. The purpose of this GUI is to:
  1. Select an Excel file and read it into the MATLAB workspace
  2. Modify the data that came from the file. In this case by multiplying by a scalar
  3. Write the modified data into an Excel file with a name derived from the original filename
The first video is all about the planning of the GUI.

The second video creates the low-level functions needed to implement the functionality

The third video creates a single m-file that runs the low-level functions

The final video implements the simple GUI discussed here, calling the functions created above.

20 CommentsOldest to Newest

MATLAB newbie replied on : 1 of 20
Hi By using the xlsread function, MATLAB only reads from the first sheet in excel. The question I want to ask is how can I read from other sheets or even create one when exporting data into an excel spreadsheet? Thanks
dhull replied on : 2 of 20
@"MATLAB Newbie" https://www.mathworks.com/help/matlab/ref/xlsread.html Look at the third syntax in the list. It shows how to specify the Excel sheet you want to read with MATLAB. Doug
Cliff replied on : 5 of 20
I am working on a project where an avi video file is opened up inside a GUI made within MatLab (version 7.7.0). My problem is when I try to open avi video files from an external hardrive (also copying the file from the external hardrive to the computer), a pop-up error displays of "Video file wasn't read!" Any ideas?
Glen replied on : 7 of 20
Hi Doug! I was wondering how would having function scripts separately from the GUI script affect the program? Would that mean that I would not be able to compile it into .exe? Do I need to have these function scripts open at all time in order for the .m and .fig files to be functional?
Sandrine replied on : 9 of 20
Hi Doug, Thank you so much! Your tutorials are great and very useful. It helped me understand very quickly how to wrap a GUI onto my code. Thanks again! Sandrine
wan replied on : 10 of 20
Hi Doug, i would like to use GUIDE to create a GUI that is able to perform classification tasks, including import datasets from workspace, trigger neural network and also display the result. Is it possible to do these in the GUI? And is there any teaching material guides on this? Thank you and have a nice day =)
Diogo Sousa replied on : 12 of 20
Hi, I have some problem trying to create excel files using GUI. So I want to create excel files named by user using GUI. To create files i'm using xlswrite(FILE,ARRAY,SHEET), but I cannot associate the name received from EDITbox (GUI). On Gui I use get(handles.edit1,'String') and its working very well, but the command xlswrite dont let me associate a variable to FILE, I can just put the name with '', so I cannot create diferent files with diferent names. tks Diogo
Doug replied on : 13 of 20
Diogo, You should be able to do something like: fileName = get(handles.edit1,’String’) And then pass the variable FileName to the function xlswrite. Doug
Shashank Singh replied on : 14 of 20
Hi Doug, Thanks for such informatory videos. However I have a doubt which I hope you could help me with. Is it mandatory to put the excel file in Matlab folder for accessing the .xlsx file. I want to upload the data from a database outside of the matlab folder. How is it possible to do that?? Any help. Regards Shashank
Cormac replied on : 16 of 20
Is it possible to specify which excel sheet winopen opens to? Or is there any other way of doing this? Cormac
Doug replied on : 17 of 20
@Cormac, https://www.mathworks.com/help/releases/R2014a/matlab/ref/xlsread.html There is an option to choose the sheet.
Stuart McGarrity replied on : 20 of 20
Hello mms, Do you want to specify the file name via a text box rather than by pressing a button and selecting a file?

Add A Comment

Your email address will not be published. Required fields are marked *

Preview: hide