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:
problem with loading mat-file from a directory

Subject: problem with loading mat-file from a directory

From: Hermano Cappa

Date: 29 Apr, 2012 18:59:07

Message: 1 of 2

Hey,

I saved all my results in several mat-files which are stored in different directories. However, when I overwrite all the mat-files (with the same name but with new results) in a folder and place the old data to another folder, it seems that Matlab is still using the old data when I load the mat-files from the directory with the new (overwrited) data. It seems Matlab holds the old data in its memory or something and still uses it to plot my results. I use the following code for loading my data from a directory different than the working directory:

clear all
close all
clc

sigma = logspaced(-3,4);

path(path,'C:Desktop\..........')

load k_nondim.mat

k_6bar = k_nondim;

plot(sigma,k_6bar)
 

Subject: problem with loading mat-file from a directory

From: ImageAnalyst

Date: 29 Apr, 2012 22:14:04

Message: 2 of 2

This doesn't make sense. There's something you're not telling us.
Give us that actual source code, including both where you save() to
the mat files, as well as where you retrieve the data from the mat
files with load().

Most likely it's a path issue. Why are you not using exist() and
fullfile() to write robust code? Why are you using path() instead of
constructing the actual full filename (folder+base filename +
extension)? And I hope you're not using cd all over the place as
recommended against in the FAQ:
http://matlab.wikia.com/wiki/FAQ#Where_did_my_file_go.3F_The_risks_of_using_the_cd_function.

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