Home » excel » matlab produce excel file in GUI

matlab produce excel file in GUI

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have example.xlsx file that contains some data.

I want to show the data in a GUI and I want there is an option to edit the xlsx file in the GUI.

Is there an option to do this? Does someone know anything about it?

I tried to find the xls via the ActiveX control, but I didn’t see an option for that :/

I have matlab 2010a and these are my options when I press ‘ActiveX control’:

enter image description here

thank you :]

How to&Answers:

You don’t need activeX, matlab has the built-in functions, xlswrite and xlsread:

Help File:

xlswrite(filename,A) writes array A to the first worksheet in Excel
file filename, starting at cell A1.

xlswrite(filename,A,sheet) writes to the specified worksheet.

xlswrite(filename,A,range) writes to the rectangular region specified
by range in the first worksheet of the file. Specify range using the
syntax ‘C1:C2’, where C1 and C2 are two opposing corners that define
the region.

xlswrite(filename,A,sheet,range) writes to the specified sheet and
range.

status = xlswrite(filename,A,sheet,range) returns the completion
status of the write operation: true (logical 1) for success, false
(logical 0) for failure. Inputs sheet and range are optional.

[status,msg] = xlswrite(filename,A,sheet,range) returns any warning or
error message generated by the write operation in structure message.
Inputs sheet and range are optional.

and:

[num,txt,raw] = xlsread(filename) reads data from the first worksheet
in the Microsoft Excel spreadsheet file named filename and returns the
numeric data in array num. Optionally, returns the text fields in cell
array txt, and the unprocessed data (numbers and text) in cell array
raw. If your system does not have Excel for Windows, xlsread operates
in basic import mode, and reads only XLS or XLSX files.

[num,txt,raw] = xlsread(filename,sheet) reads the specified worksheet.

[num,txt,raw] = xlsread(filename,range) reads data from the specified
range of the first worksheet in the file. Specify range using the
syntax ‘C1:C2’, where C1 and C2 are two opposing corners that define
the region.

[num,txt,raw] = xlsread(filename,sheet,range) reads from the specified
sheet and range.

[num,txt,raw] = xlsread(filename,-1) opens an Excel window to
interactively select data. Supported only on Windows systems with
Excel software.

[num,txt,raw] = xlsread(filename,sheet,range,’basic’) reads data from
the spreadsheet in basic mode, the default on systems without Excel
for Windows.

[num,txt,raw,custom] = xlsread(filename,sheet,range,”,functionHandle)
reads from the spreadsheet, executes the function associated with
functionHandle on the data, and returns the final results. Optionally,
returns additional custom output, which is the second output from the
function. xlsread does not change the data stored in the spreadsheet.
Supported only on Windows systems with Excel software.

http://www.mathworks.com/help/techdoc/ref/xlswrite.html

With your choice of user interaction and display style (not sure if you want plots or tables, buttons or sliders) this allows you to interact with xls documents.

Answer:

Try activeX controls in GUIDE. One of the is Excel control.