help with analysis currents measurement plot.
Mostrar comentarios más antiguos
Hello everyone,
I have a plot where it has columns where there are values of currents(last column ) measured from the power supply function of the time (first column).
I want to present the information as a plot of currents as a function of time,
Or displaying the currents in the function of the number of measurements.
Can someone please write me a code for this?
log txt plot (Hv_test) attached.
thanks a lot.
1 comentario
darova
el 17 de En. de 2020
Use plot function
Respuestas (4)
Claudio Iturra
el 21 de En. de 2020
1 voto
Hello Freddy, I can help you with this.....
1) Use the function textscan to read your text file.
2) Separate each variable.
3) Create your vector time; time = datenum(year,month,day,hour,minute,second)
4) Create an index for each sensor
5) plot your data (if x is your variable, and you wanna plot your x valueas measured with the sensor 1)
plot(time(find(ind==1)),x(find(ind==1)))
1 comentario
Freddy Belhasan
el 24 de En. de 2020
Guru Mohanty
el 22 de En. de 2020
clc;
clear all;
fid=fopen('Hv_test.txt');
C = textscan(fid,'[%d-%d-%dT%f:%f:%f]: %s %s %s %s %s %s %s %s [%.3f];');
fclose(fid);
time=[C{4} C{5} C{6}]; % Extract Hour Minute & Second
time_in_sec=time(:,1)*3600 + time(:,2)*60 + time(:,3); %time in Second
current=[C{15}];
pt=[time_in_sec current];
plot(pt(:,1),pt(:,2));

Freddy Belhasan
el 24 de En. de 2020
Editada: Freddy Belhasan
el 24 de En. de 2020
0 votos
1 comentario
Freddy Belhasan
el 24 de En. de 2020
Editada: Freddy Belhasan
el 24 de En. de 2020
Guru Mohanty
el 25 de En. de 2020
Hi Freddy, You can extract current values from the txt file by the help of find function of MATLAB.Here is the code for it.
clc;
clear all;
fid=fopen('Hv_test.txt');
C = textscan(fid,'[%d-%d-%dT%f:%f:%f]: %s %s %s %s %s %s %s %s [%.3f];');
fclose(fid);
current_Index = find(contains(C{13},'[IMonL]'));
time=[C{4} C{5} C{6}]; % Extract Hour Minute & Second
t_in_sec=time(:,1)*3600 + time(:,2)*60 + time(:,3); %time in Second
c=[C{15}];
current=c(current_Index);
time_in_sec=t_in_sec(current_Index);
pt=[time_in_sec current];
plot(pt(:,1),pt(:,2));

Categorías
Más información sobre Power Converters en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!