generate a vector input by combining various fields

Hi all, currently i am working on lifetime prediction model of battery by utilizing multiple inputs. I have created structures of every input at each cycle individually by downsampling like voltage current temperature and capacity. But i am confused to create the vector input of each cycle by concatinating every input like [V1 C1 T1 Cap1]......[V168 C168 T168 Cap168].
I would be grateful for any assistance in this regard.

4 commentaires

I find it suspicious that each row in your cell has the same number of rows as the cell row number. Are you possibly accidentally accumulating all of the data as you go? So voltage{50} contains all of the information from voltage{49} together with one more row?
Sir, with regards to the above , for field 1, it denotes the 1st value of all voltages until last cycle ie 168. Similar with rest of the structures too. Also the same is implemented for current as well as temperature. I am currently trying to utilize the parameters with individual cycle . The expected result for eg. should consist of 4*170 i.e. values of each voltage current temperature and capacity for every cycle individually. Below is the code created for voltage.
%% load the value of voltages from each cycle
C_cycle={B0005.cycle.type};
C_cycle= C_cycle';
index= find(ismember(C_cycle,'charge'))
cnt=0
for i=1:length(index);
for ii=1:10:length(B0005.cycle(index(i)).data.Voltage_measured);
cnt=cnt+1 ;
voltage(i,cnt)=B0005.cycle(index(i)).data.Voltage_measured(ii);
end
cnt=0;
end
index=[]
voltage = voltage';
for vk=1:size(voltage,1)
for i=1:length(find(voltage(vk,:)))
D_voltage(vk).voltage(vk,i)=voltage(vk,i)
end
end
Look more closely at your statements
for vk=1:size(voltage,1)
for i=1:length(find(voltage(vk,:)))
D_voltage(vk).voltage(vk,i)=voltage(vk,i)
end
end
Under what circumstances do you write to D_voltage(vk).voltage(1,i) ? Other than the case where vk = 1 ?
When vk is 1, you write to voltage row 1 (only). When vk is 2, you write to voltage row 2 (only). When vk is 3, you write to voltage row 3 (only). And so on.
All of that data could be combined in a single array...
for i=1:length(find(voltage(vk,:)))
You do a find() on voltage(vk,:), so you are getting out a list of the column numbers that contain non-zero voltages. That part is potentially okay in itself. Then you take length() of that, so you know how many such entries there are. But then you increment from 1 to that length, indexing by the number, independent of whether that column contains a 0 or not. When you do this you are potentially going to be copying values that are 0 and potentially missing non-zero values.
The situation is not impossible, but for it to be valid, you would need to know that zeros only ever appear at the ends of rows, but that there might be a variable number of them.
If you do happy to want to copy to the last non-zero then I suggest
for i = 1 : find(voltage(vk,:),1,'last')
Thank you for the constructive suggestion Sir. I have taken a note of it and will try to implement it accordingly. furthermore, i hope if you can assist me in creating a vector by combining other parameters with voltage like [V I T Cap] for individual cycle. For eg [v1 i1 t1 cap1] [v2 i2 t2 cap2]........[v168 i168 t168 cap168].
Regards

Réponses (0)

Cette question est clôturée.

Clôturé :

le 20 Août 2021

Community Treasure Hunt

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

Start Hunting!

Translated by