Error using Battery.loadDataFromMatFile Unable to locate voltage variable in file '03-11-17_08.47 25degC_5Pulse_HPPC_Pan18650PF.mat'
3 views (last 30 days)
Show older comments
Hey everyone. I just run the Example_DischargePulseEstimation.m code which is prepared code from MATLAB. To run the code I wrote this to command
open('Example_DischargePulseEstimation.m')
and clicked enter.It worked but I want to use this code for another "*.mat" data file.So I just copy paste a code and adapt it to my data but MATLAB constantly gives error.
The Code That I used for Another data:
psObj = Battery.PulseSequence;
disp(psObj)
FileName = '03-11-17_08.47 25degC_5Pulse_HPPC_Pan18650PF.mat';
[time,voltage,current] = Battery.loadDataFromMatFile(FileName);
addData(psObj,time,voltage,current);
The Error It's given:
Error using Battery.loadDataFromMatFile
Unable to locate voltage variable in file '03-11-17_08.47 25degC_5Pulse_HPPC_Pan18650PF.mat'
Error in Battery.loadDataFromMatFile Error in kod3 (line 33)
[time,voltage,current] = Battery.loadDataFromMatFile(FileName);
The data in code is in attached file!!
0 Comments
Answers (1)
Gowthami
on 22 Nov 2022
Hello Hanife,
It is my understanding that you are getting an error while loading data from MAT file.
I could see that executing the below command returning 'meas: [1×1 struct]' ,
open '03-11-17_08.47 25degC_5Pulse_HPPC_Pan18650PF.mat'
All the fields are present inside the meas struct, Because of this you are getting error as 'Unable to locate voltage variable in file '03-11-17_08.47 25degC_5Pulse_HPPC_Pan18650PF.mat''
The function 'Battery.loadDataFromMatFile(FileName)' is expecting the filed names as current, time, and voltage as shown in the below image,
Please refer to the below link for more information on saving a few specific fields into a MAT file - https://www.mathworks.com/help/matlab/import_export/load-parts-of-variables-from-mat-files.html
See Also
Categories
Find more on Powertrain Blockset in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!