Filter löschen
Filter löschen

Error using load. Unable to read file '...'. Input cannot be a directory.

45 Ansichten (letzte 30 Tage)
Julius Å
Julius Å am 29 Sep. 2020
Bearbeitet: Sudhakar Shinde am 29 Sep. 2020
I get the error Error using load. Unable to read file '...'. Input cannot be a directory. when using
load(currentmatfile, 'example');
where currentmatfile is a string representing a path with a mat-file, e.g. 'Z:\folder1\folder2\folder3\folder4\folder5\folder6\XXXXXX.mat' and 'example' is the name of the variable that I want to load from the mat-file.
When doing this, I get the error "Error using load. Unable to read file 'Z:\folder1\folder2\folder3\folder4\folder5\folder6\XXXXXX.mat'. Input cannot be a directory.".
How do I solve this problem? What is the cause?

Antworten (1)

Sudhakar Shinde
Sudhakar Shinde am 29 Sep. 2020
Bearbeitet: Sudhakar Shinde am 29 Sep. 2020
  1. The mat file you are using this need to be in matlab current path. You can add folders and subfolders in path manually by right clicking on folder.
Then you can use
load('Data.mat', 'example');
2. Alternatively you can use command lines to get mat file .
[file,path] = uigetfile('*.mat');
currentfile=[path,file];
load(currentfile,'example')
See the example variable loaded in workspace.

Kategorien

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

Community Treasure Hunt

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

Start Hunting!

Translated by