Effacer les filtres
Effacer les filtres

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

3 vues (au cours des 30 derniers jours)
Alberto Acri
Alberto Acri le 22 Juil 2023
Modifié(e) : Stephen23 le 22 Juil 2023
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';

Réponse acceptée

Stephen23
Stephen23 le 22 Juil 2023
Modifié(e) : Stephen23 le 22 Juil 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?:

Plus de réponses (1)

Bruno Luong
Bruno Luong le 22 Juil 2023
Modifié(e) : Bruno Luong le 22 Juil 2023
folder = 'C:\Users\Desktop\folder_test';
file = 'test.mat';
load([folder filesep() file])

Catégories

En savoir plus sur File Operations dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by