Filter löschen
Filter löschen

import to the workspace a .mat file saved in a folder other than pwd

3 Ansichten (letzte 30 Tage)
How can I import a .mat file saved in a folder other than pwd to the workspace?
folder = 'C:\Users\Desktop\folder_test';
file = 'test.mat';

Akzeptierte Antwort

Stephen23
Stephen23 am 22 Jul. 2023
Bearbeitet: Stephen23 am 22 Jul. 2023
The recommended approach is to use FULLFILE (and to always LOAD into an output variable):
S = load(fullfile(folder,file))
Why do you imagine that this has changed since last time you asked how to define path strings?:

Weitere Antworten (1)

Bruno Luong
Bruno Luong am 22 Jul. 2023
Bearbeitet: Bruno Luong am 22 Jul. 2023
folder = 'C:\Users\Desktop\folder_test';
file = 'test.mat';
load([folder filesep() file])

Kategorien

Mehr zu File Operations finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by