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