The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: msopen command using variable for file name
Replies: 1   Last Post: Jan 28, 2013 11:23 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Steven Lord

Posts: 18,038
Registered: 12/7/04
Re: msopen command using variable for file name
Posted: Jan 28, 2013 11:23 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Mark " <> wrote in message
> HI,
> I don't seem to be getting the syntax right for using the msopen function
> to have a Word file open. It works fine if I specifically define the
> filename, but I want to use a variable that I am creating.
> Here is the code:
> docfilename = char(strcat(fnpheader(7,2),fnpheader(7,3)));
> msopen docfilename;

Note this is equivalent to:

msopen('docfilename') % Open the file whose name is the string "docfilename"


msopen(docfilename) % Open the file whose name is contained in the variable
named docfilename

> An example of resulting docfilename is
> \\snr14\g1$\Calibration\PyranometerCalibrarion\Information\Instrument
> Calibration Analysis using MATLAB v1.docx
> This looks like it should work. I have tried
> msopen(docfilename); also.
> I get an error message that
> Cell contents reference from a non-cell array object.
> Error in msopen (line 31)
> file=files{i};
> Any ideas? THanks

Contact the author of the msopen file and ask for their help debugging and
fixing this problem?

Or, if you have Microsoft Office installed on your machine and associated
with the appropriate file extensions, just use the WINOPEN function.

Steve Lord
To contact Technical Support use the Contact Us link on

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.