problem in loading .mat file (Error using load)

20 ビュー (過去 30 日間)
Tae Lim
Tae Lim 2019 年 6 月 19 日
編集済み: per isakson 2019 年 6 月 22 日
Hi,
I am having a trouble loading a particular mat file in Matlab.
I have close to 30 mat files that I consecutively generated using one script (script A). I am loading each of these mat file in another script (script B) for further analysis. When I try to load one particular mat file in script B, I get the error that looks something like this:
Error using load
Cannot read file C:\Users\....\Filename_SC7_... .mat.
'SC7' indicates the 7th file I am reading. All mat files that I load have the same name scheme with the value following SC changing (e.g. ...SC1....mat, ...SC2....mat) I suspected the file being corrupt and regenerated the file but I am still getting the same error message. I used script A and script B before without any troubles in the past so I am not sure why I am getting this issue now. Pretty much the only thing I changed this time is the name scheme, but I have used similar name schemes in the past as well.
Any comments will be appreciated!
  9 件のコメント
per isakson
per isakson 2019 年 6 月 21 日
Tae Lim
Tae Lim 2019 年 6 月 21 日
per isakson, I just fixed the issue. You should be able to access the file now. Thank you for pointing this out!

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

回答 (1 件)

per isakson
per isakson 2019 年 6 月 21 日
On Win10, R2018b I have
  • downloaded your two files from Box successfully
  • dragged the 'Util_Tgt0.7_SC7_dr0.07_20181111_test2_FirstThreeSets_UNloadable.mat' from the Current Folder pane to Workspace pane. Load failed. Interactive Open also failed
>> load('Util_Tgt0.7_SC7_dr0.07_20181111_test2_FirstThreeSets_UNloadable.mat')
Error using load
Cannot read file H:\m\cssm\Util_Tgt0.7_SC7_dr0.07_20181111_test2_FirstThreeSets_UNloadable.mat.
Capture.PNG
  • dragged the 'Util_Tgt0.7_SC7_dr0.07_20181111_test2_BAUonly.mat' from the Current Folder pane to Workspace pane. Load successful. Peek at Results
>> Results.BAU
ans =
struct with fields:
newbau: [14×96 double]
deadtotbau: [14×96 double]
retbau: [14×60×96 double]
rettotbau: [14×96 double]
totbau: [14×96 double]
CostNewCap_bau: [14×96 double]
CostNewFuel_bau: [14×96 double]
CostNewMaint_bau: [14×96 double]
CostRet_bau: [14×96 double]
CostOldFuel_bau: [14×96 double]
CostOldMaint_bau: [14×96 double]
newbau_cap: [14×96 double]
deadtotbau_cap: [14×96 double]
rettotbau_cap: [14×96 double]
totbau_cap: [14×96 double]
Ebau: [96×1 double]
linear_emcon_of_interest: [96×1 double]
EVcharegeEFsbau: [96×1 double]
retbyagebau: [96×60 double]
TotPrimaryEnergy_bau: [14×96 double]
CFnewPriE_Util: [14×96 double]
CFoldPriE_Util: [14×60×96 double]
oldbau: [14×60×96 double]
deadbau: [14×60×96 double]
discountrate: 0.07
totUtilcostmatbau: [96×3 double]
xbau: [81984×1 double]
>>
  3 件のコメント
per isakson
per isakson 2019 年 6 月 21 日
編集済み: per isakson 2019 年 6 月 21 日
I've downloaded and loaded "FirstTwoSets" successfully.
>> load('Util_Tgt0.7_SC7_dr0.07_20181111_test2_FirstTwoSets.mat')
>> Results
Results =
struct with fields:
BAU: [1×1 struct]
CAY2015: [1×1 struct]
>>
>> Results.CAY2015
ans =
struct with fields:
new: [14×96 double]
deadtot: [14×96 double]
rettot: [14×96 double]
tot: [14×96 double]
CostNewCap: [14×96 double]
CostNewFuel: [14×96 double]
CostNewMaint: [14×96 double]
CostRet: [14×96 double]
CostOldFuel: [14×96 double]
CostOldMaint: [14×96 double]
new_cap: [14×96 double]
deadtot_cap: [14×96 double]
rettot_cap: [14×96 double]
tot_cap: [14×96 double]
E: [96×1 double]
Ebau: [96×1 double]
linear_emcon_of_interest: [96×1 double]
AnnEm: [14×96 double]
E_Captured: [96×1 double]
EVchargeEFs: [96×1 double]
incrUtil_costs_by_type: [96×3 double]
incrUtilcostsyearly: [96×1 double]
retbyage: [96×60 double]
TotPrimaryEnergy: [14×96 double]
CFnewPriE_Util: [14×96 double]
CFoldPriE_Util: [14×60×96 double]
old: [14×60×96 double]
dead: [14×60×96 double]
ret: [14×60×96 double]
totUtilcostmat: [96×3 double]
R: [36×27 double]
exitflag: 1
x: [81984×1 double]
E_annualReduc: 0.010505
>>
per isakson
per isakson 2019 年 6 月 21 日
編集済み: per isakson 2019 年 6 月 22 日
I've no good proposals, however
  • In the File Exchange there are a few submissions that read mat-files with Java. See tag:"mat-file" . Maybe, one of these fails and returns a useful error message.
  • Save your data to a mat-file version 7.3. See MAT-File Versions. Try to read the mat-file with HFD5. Start with h5disp - Display contents of HDF5 file
  • Contact tech-support (if your license includes support)

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

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by