Importing .mat files on a mac

19 views (last 30 days)
Braden Kerr
Braden Kerr on 28 Oct 2019
Commented: Braden Kerr on 28 Oct 2019
Currently i have a large file from SignalCalc that has 54 sub trials in it. For each trial subfolder under the main lab folder there is a matlab folder from which i want to extract the .mat file and a specific variable from that file. As best as a can show in a folder path would be (main folder/ sub folders for the trial/ matlab/ .mat file)
Here is the code im currently trying to use to extract it but unsure why its not working. I get an error regarding cd([dir '/MATLAB/']) that says name is non existant or not a directory.
The main file (Group A - Lab 3) is in my downloads file. THis is the specific error message.
Error using cd
Cannot CD to /Users/BradensMac/Downloads/Group A - Lab 3/Run00001/MATLAB/ (Name is nonexistent or
not a directory).
Error in thirdlab (line 6)
dir = [Labdir '/Run000' Num1]; cd([dir '/MATLAB/'])
done = 0;
Labdir = '/Users/BradensMac/Downloads/Group A - Lab 3';
while done == 0
Num1 = input('Input the run ID of less damped case in single quotes (i.e. ''01'')');
dir = [Labdir '/Run000' Num1];
cd([dir '/MATLAB/'])
load('DPsv00001.mat', 'X1')
done = input('Input 0 to keep uploading, or 1 to finish');
end
  2 Comments
Fabio Freschi
Fabio Freschi on 28 Oct 2019
Do you have a /Users/BradensMac/Downloads/Group A - Lab 3/Run00001/MATLAB/ directory? What happens if you type
cd /Users/BradensMac/Downloads/Group A - Lab 3/Run00001/MATLAB/
in Mac terminal?
Braden Kerr
Braden Kerr on 28 Oct 2019
I actually figured it out, I had to write a script in automated to properly copy the folder path from the folder to Matlab. It's a service automation that is easy to set up.

Sign in to comment.

Answers (0)

Categories

Find more on File Operations in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!