How to save MATLAB data to Excel

Source: Internet
Author: User

The recent time to do simulation needs to use this function, so search the Internet, find a feasible method.

-----------------------------------------------------------------------------

Excel = Actxserver (' Excel.Application '); % open an Excel action object
Set (Excel, ' visible ', 2); % makes the Excel object visible, which opens the Excel window,

% is actually applied when set to invisible
workbooks = Excel.Workbooks; % Create work this group object
Workbook = Invoke (workbooks, ' Add '); % Add a work book
sheets = excel.activeworkbook.sheets; % get the current active work of the form group, a work book has three forms (sheets)
Sheet = Get (sheets, ' item ', 1); % get a form for a form group
Invoke (sheet, ' activate '); % activates the form
ActiveSheet = Excel.activesheet; % gets the handle of the current active form
Activesheetrange = Get (ActiveSheet, ' range ', ' a1:a170 '); % setting write to Range
Set (Activesheetrange, ' value ', 10); % Write Data
Invoke (Workbook, ' SaveAs ', ' W.xls '); % Save File

-----------------------------------------------------------------------------

The basic statement is like this, I tried it, the effect is OK, look at the figure below.

How to save MATLAB data to Excel

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.