From: Steven Lord on

"Image Analyst" <imageanalyst(a)mailinator.com> wrote in message
news:i13biu$adv$1(a)fred.mathworks.com...
> CyberFrog:
> What operating system are you using? If you're using windows, you can
> issue this command
>
> !notepad 'C:\My Folder\mytextFile.txt';
>
> Unfortunately it appears that you have to pass the exact name of the file
> as a literal string - it does not appear to accept variables like
>
> !notepad fileName;

That is correct -- the bang operator (!) takes EVERYTHING following the !
character on that line and sends it to the system exactly as it appears on
the line.

To do what you want, use the SYSTEM function.

fileName = 'c:\My Folder\mytextFile.txt';
system(['notepad "' filename '"'])

Note the use of double-quotes to account for the spaces in fileName.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com


From: CyberFrog on
"Steven Lord" <slord(a)mathworks.com> wrote in message <i1561u$is4$1(a)fred.mathworks.com>...
>
> "Image Analyst" <imageanalyst(a)mailinator.com> wrote in message
> news:i13biu$adv$1(a)fred.mathworks.com...
> > CyberFrog:
> > What operating system are you using? If you're using windows, you can
> > issue this command
> >
> > !notepad 'C:\My Folder\mytextFile.txt';
> >
> > Unfortunately it appears that you have to pass the exact name of the file
> > as a literal string - it does not appear to accept variables like
> >
> > !notepad fileName;
>
> That is correct -- the bang operator (!) takes EVERYTHING following the !
> character on that line and sends it to the system exactly as it appears on
> the line.
>
> To do what you want, use the SYSTEM function.
>
> fileName = 'c:\My Folder\mytextFile.txt';
> system(['notepad "' filename '"'])
>
> Note the use of double-quotes to account for the spaces in fileName.
>
> --
> Steve Lord
> slord(a)mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com
>

Thanks for this, do you happen to know how to change the list if file extensions when you try to save the files?
From: Steven Lord on

"CyberFrog" <domlee55(a)hotmail.com> wrote in message
news:i1muos$rpg$1(a)fred.mathworks.com...
> "Steven Lord" <slord(a)mathworks.com> wrote in message
> <i1561u$is4$1(a)fred.mathworks.com>...

*snip*

> Thanks for this, do you happen to know how to change the list if file
> extensions when you try to save the files?

I don't understand what you mean in the context of the original question.
If this is a separate issue, please start a NEW thread for it; if it's
related to your original question, please clarify what you're asking and how
it fits in with that original question.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com