<
tolst...@gmail.com> wrote in message
news:20a162b8-1c1a-4d40...@googlegroups.com...
> Whenever I read excel data info Matlab, and a cell contains a formula that
> yields a text value, I get a NaN in Matlab. This happens even if I change
> the format of the excel sheet cell to text. This way I can never read
> dynamic texts from Excel, which largely reduces the value of xlsread.
In order to evaluate that formula, you need to be running Microsoft Excel.
Correct?
As an analogy, I can write the formula:
sin(0)
inside a MATLAB program file. If I tried to read that program file in C++,
all I'll get is the text string "sin(0)". In order to obtain the _value_ of
that expression, I need to evaluate it in MATLAB.
> For instance, a cell in Excel contains a formula yielding a text value
> that I want to read into Matlab to use a header of a figure. The text in
> Excel adapts automatically when I change the data to reflect some
> alternative situation.
The text may change, but only when the file is being processed by Excel and
the formula is evaluated.
> It happens when using xlsread on Mac OS X. Mac OS X is handicapped
> enormously form the fact that xlsread on the Mac can only read old 95/5.0
> Excel file versions. As long as the Mathworks refuses to update this for
> its Mac users, we have to live with it. But it is mighty irritating. I
> hope someone has solved this issue.
As of release R2012b, according to the Release Notes for MATLAB:
"The xlsread function now reads data from XLSM, XLTX, and XLTM files on all
platforms. Previously, this functionality was available only on Microsoft
Windows systems with Excel software."
http://www.mathworks.com/help/matlab/release-notes.html
I don't think that will resolve the problem you're experiencing, though,
which is that you want MATLAB to be able to evaluate Excel "code" as part of
the reading process. On Windows, if you have Microsoft Excel installed,
MATLAB uses COM to interact with Excel and assuming that the file is set to
automatically reevaluate that formula when the file is opened, you would be
able to do what you want. But I'm not certain that approach is possible on
Macs.
--
Steve Lord
sl...@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com