<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Existence in MATLAB</title>
	<link>http://blogs.mathworks.com/loren/2006/02/01/existence-in-matlab/</link>
	<description>Loren Shure  works on design of the MATLAB language at The MathWorks. She writes here about once a week on MATLAB programming and related topics. </description>
	<pubDate>Mon, 08 Sep 2008 03:56:12 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2006/02/01/existence-in-matlab/#comment-25224</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Tue, 22 Jan 2008 21:09:03 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2006/02/01/existence-in-matlab/#comment-25224</guid>
		<description>Saadia and Peter-

The problem is, you have a created a variable called myFile so asking if it exists gets things in a mess.  And there probably isn't a file itself named 'myFile' but the contents of myFile.  You need to do this:

if exist(myFile,'file)
...

which will use the contents of the variable myFile 

or you might be able to use which, but in functional form

which(myFile)

and see if it returns empty or not (though I don't think which will work for something not on the matlabpath).

--Loren</description>
		<content:encoded><![CDATA[<p>Saadia and Peter-</p>
<p>The problem is, you have a created a variable called myFile so asking if it exists gets things in a mess.  And there probably isn&#8217;t a file itself named &#8216;myFile&#8217; but the contents of myFile.  You need to do this:</p>
<p>if exist(myFile,&#8217;file)<br />
&#8230;</p>
<p>which will use the contents of the variable myFile </p>
<p>or you might be able to use which, but in functional form</p>
<p>which(myFile)</p>
<p>and see if it returns empty or not (though I don&#8217;t think which will work for something not on the matlabpath).</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Saadia Iftikhar</title>
		<link>http://blogs.mathworks.com/loren/2006/02/01/existence-in-matlab/#comment-25214</link>
		<dc:creator>Saadia Iftikhar</dc:creator>
		<pubDate>Tue, 22 Jan 2008 17:29:54 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2006/02/01/existence-in-matlab/#comment-25214</guid>
		<description>How to deal with problem which Peter addressed? If File is in MAT format and want to check its existence? How to do this?

peter replied on October 4th, 2006 at 7:49 pm : 

Yes, but what about


myFile = [path filesep ‘foo.mat’];
if ~exist(’myFile’, ‘file’)
%create the file
end</description>
		<content:encoded><![CDATA[<p>How to deal with problem which Peter addressed? If File is in MAT format and want to check its existence? How to do this?</p>
<p>peter replied on October 4th, 2006 at 7:49 pm : </p>
<p>Yes, but what about</p>
<p>myFile = [path filesep ‘foo.mat’];<br />
if ~exist(’myFile’, ‘file’)<br />
%create the file<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://blogs.mathworks.com/loren/2006/02/01/existence-in-matlab/#comment-12911</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Thu, 05 Oct 2006 00:49:44 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2006/02/01/existence-in-matlab/#comment-12911</guid>
		<description>Yes, but what about

myFile = [path filesep 'foo.mat'];
if ~exist('myFile', 'file')
    %create the file
end

This fails, because Matlab returns 0, thinking that myFile is a var (which it is, but it's also a file).  Hardcoding the string, of course, works.</description>
		<content:encoded><![CDATA[<p>Yes, but what about</p>
<p>myFile = [path filesep &#8216;foo.mat&#8217;];<br />
if ~exist(&#8217;myFile&#8217;, &#8216;file&#8217;)<br />
    %create the file<br />
end</p>
<p>This fails, because Matlab returns 0, thinking that myFile is a var (which it is, but it&#8217;s also a file).  Hardcoding the string, of course, works.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: loren</title>
		<link>http://blogs.mathworks.com/loren/2006/02/01/existence-in-matlab/#comment-25</link>
		<dc:creator>loren</dc:creator>
		<pubDate>Mon, 06 Feb 2006 12:31:38 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2006/02/01/existence-in-matlab/#comment-25</guid>
		<description>You can in MATLAB or the Instrument Control Toolbox.  A good place to look for this sort of information is &lt;a href="http://www.mathworks.com/support/" rel="nofollow"&gt;The MathWorks support page&lt;/a&gt;.  You can search for the function serial and read the documentation beyond the reference pages.  There are also some illustrative demo pages.</description>
		<content:encoded><![CDATA[<p>You can in MATLAB or the Instrument Control Toolbox.  A good place to look for this sort of information is <a href="http://www.mathworks.com/support/" rel="nofollow">The MathWorks support page</a>.  You can search for the function serial and read the documentation beyond the reference pages.  There are also some illustrative demo pages.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: david</title>
		<link>http://blogs.mathworks.com/loren/2006/02/01/existence-in-matlab/#comment-24</link>
		<dc:creator>david</dc:creator>
		<pubDate>Sun, 05 Feb 2006 02:09:01 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2006/02/01/existence-in-matlab/#comment-24</guid>
		<description>Hello. 

Great blog. It is really helpfull with some aspects of Matlab. 
I would like to ask you if it is possible to control a device with matlab or "data acquisition toolbox" trough the serial port RS-232.

thank you.</description>
		<content:encoded><![CDATA[<p>Hello. </p>
<p>Great blog. It is really helpfull with some aspects of Matlab.<br />
I would like to ask you if it is possible to control a device with matlab or &#8220;data acquisition toolbox&#8221; trough the serial port RS-232.</p>
<p>thank you.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
