load function doesn't load variable correctly

7 ビュー (過去 30 日間)
Karl-Heinz Böhm
Karl-Heinz Böhm 2020 年 10 月 29 日
コメント済み: Karl-Heinz Böhm 2020 年 10 月 29 日
I use the "load" function to get some variables stored in a mat file.
If I open the file from Windows explorer, I get a variable which is a data structure and it holds further objects.
In case my script opens the file using the "load" function, the object is damaged and holds only empty arrays.
Here is the code I use:
clc
clear all
close all
restoredefaultpath
[file,path] = uigetfile('.mat','Select input file!')
if isequal(path, 0)
disp('User selected ''Cancel'', stop the script');
return;
else disp(['Selectet file ',strcat(path,file)])
load(strcat(path,file),'-mat', "Cell_Nr");
end
Has anybody an idea what's going on there?
It seems to me that there is a bug in the load function.

採用された回答

Walter Roberson
Walter Roberson 2020 年 10 月 29 日
restoredefaultpath
You are loading a custom object type. If the class definition is not on your path because you restored the default path, then MATLAB would not be able to load the objects.
Usually it would warn that it was loading the objects as uint8 instead.
  1 件のコメント
Karl-Heinz Böhm
Karl-Heinz Böhm 2020 年 10 月 29 日
It seems to work now, Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by