Importing .mat files on a mac

27 visualizzazioni (ultimi 30 giorni)
Braden Kerr
Braden Kerr il 28 Ott 2019
Commentato: Braden Kerr il 28 Ott 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 Commenti
Fabio Freschi
Fabio Freschi il 28 Ott 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 il 28 Ott 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.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su File Operations in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by