Is there a way in MATLAB coder to get a user to identify an Excel file, then read the contents of that Excel file?

조회 수: 1 (최근 30일)
I am trying to use MATLAB Coder to package a program that reads inputs from an excel file, does a calculation, plots results, and writes outputs to Excel. The problem I am running into is I can't use xlsread, xlswrite, or actxserver. The user also needs to identify which Excel file to read in and I can't use uigetfile either.

채택된 답변

Walter Roberson
Walter Roberson 2017년 5월 23일
You cannot use xlsread() or xlswrite() in MATLAB Coder.
You can place calls to third-party libraries that can read the kind of Excel worksheets that you need. .xlsx files are Open Standard so it is easier to get patent-free code if you only need to handle .xlsx and not .xls.
One of the available libraries is LibreOffice, which forked OpenOffice after Sun was purchased by Oracle.
"The user also needs to identify which Excel file to read in and I can't use uigetfile either."
fread() can be used directly, but not fscanf() or sscanf(). But you can use coder.ceval() to fscanf(); see https://www.mathworks.com/matlabcentral/answers/165502-stand-alone-c-file#answer_161338

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by