Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
file identifier for load function

Subject: file identifier for load function

From: Nate Jensen

Date: 2 Jan, 2012 07:45:09

Message: 1 of 2

Using the following code,
fid = fopen('file1');
If fopen is able to open 'file1' fid will be some positive integer, otherwise it will be -1.

Is there a similar thing for the load function? If load is unsuccessful, the only thing I get is an error. For example,
file = load('file2');

Thanks,
Nate

Subject: file identifier for load function

From: Steven_Lord

Date: 3 Jan, 2012 03:09:17

Message: 2 of 2



"Nate Jensen" <natejensen88@gmail.com> wrote in message
news:jdrna5$9k4$1@newscl01ah.mathworks.com...
> Using the following code,
> fid = fopen('file1');
> If fopen is able to open 'file1' fid will be some positive integer,
> otherwise it will be -1.
>
> Is there a similar thing for the load function? If load is unsuccessful,
> the only thing I get is an error. For example,
> file = load('file2');

No, LOAD throws an error rather than issuing a "status flag" if the LOAD is
unsuccessful. Wrap your LOAD call in a TRY/CATCH block if you need to
recover from an unsuccessful attempt.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us