From: Jeff Court on 8 Dec 2009 21:28 I am trying to read a folder in another directory. In this case, it is just in a subfolder of the directory I am working in. Here is my working code. I am reading a file at every time step. datafilename = ['TestRead' num2str(timestep) '.dat']; soln = load (datafilename) %Load the data file based on its number The code I thought would work... datafilename = ['DataFiles/TestRead' num2str(timestep) '.dat']; soln = load (datafilename) %Load the data file based on its number Does anyone know what I am doing wrong here?
From: ImageAnalyst on 8 Dec 2009 21:57 What's the error message? You might try using fullfile() to make sure you construct the full path of the file (starting with the drive specification), not just the relative path.
From: Rune Allnor on 9 Dec 2009 00:25 On 9 Des, 03:28, "Jeff Court" <jeff.co...(a)gmail.com> wrote: > I am trying to read a folder in another directory. In this case, it is just in a subfolder of the directory I am working in. > > Here is my working code. I am reading a file at every time step. > datafilename = ['TestRead' num2str(timestep) '.dat']; > soln = load (datafilename) %Load the data file based on its number > > The code I thought would work... > datafilename = ['DataFiles/TestRead' num2str(timestep) '.dat']; > soln = load (datafilename) %Load the data file based on its number > > Does anyone know what I am doing wrong here? Assuming the directory exists and its name is correctly spelled, it might be the wrong slash. To do this fail-safe, use FILESEP to do something like pathname = 'DataFiles'; filename = 'Whatever'; datafilename = [ pathname filesep filename] datafilename = DataFiles\Whatever Rune
|
Pages: 1 Prev: xPC Target DMM-32DX-AT A/D Driver problem. Next: License plate recognition using matlab |