From: Ashleigh on
Hi,
I know this is a very elementary question, but I am trying to use fileparts() in a function to find if an xls spreadsheet exists before pasting a figure into it.
From my understanding, you should ender fileparts(fileSpec) where fileSpec is the name of the file you are looking for.
When I do this though, I either get the error:
??? Attempt to reference field of non-structure array.
or:
??? Undefined function or variable 'fileSpec'.
Can someone please explain to me what I am doing wrong?
Thanks in advance,
Ashleigh
From: Bruno Luong on
"Ashleigh " <chiefsoccer12removethis(a)aim.com> wrote in message <hmqt7k$d6e$1(a)fred.mathworks.com>...
> Hi,
> I know this is a very elementary question, but I am trying to use fileparts() in a function to find if an xls spreadsheet exists before pasting a figure into it.

FILEPARTS is not appropriate, use XLSFINFO instead.

Bruno
From: Walter Roberson on
Ashleigh wrote:
,
> I know this is a very elementary question, but I am trying to use
> fileparts() in a function to find if an xls spreadsheet exists before
> pasting a figure into it.
> From my understanding, you should ender fileparts(fileSpec) where
> fileSpec is the name of the file you are looking for.
> When I do this though, I either get the error:
> ??? Attempt to reference field of non-structure array.
> or:
> ??? Undefined function or variable 'fileSpec'.
> Can someone please explain to me what I am doing wrong?

You are failing to quote your strings.

fileparts('C:\Matlab2.6\mindread.m')