Importing .mat files on a mac

19 次查看(过去 30 天)
Braden Kerr
Braden Kerr 2019-10-28
评论: Braden Kerr 2019-10-28
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 个评论
Fabio Freschi
Fabio Freschi 2019-10-28
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 2019-10-28
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 File Operations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by