Create offset in one of the 2 datasets

I have two files one .fig file and one .txt file
I know how to merge the two datasets. But how do I make an offset in time on the .txt file. I need to offset 6 sec and I have a log of each 2 mS
figfile = 'IBox 100-100 - Copy.fig';
datafile = 'V164_Backup_KK_Con_Test1_Step1_100_100_Rev1_removed_header.txt';
fig = openfig(figfile);
T = readtable(datafile,'Format','auto');
T1 =T;
T1.DCOUTPOWERKW = (T1.DCOUTV .* T1.DCOutA ./1000);
T1.VFDPOWERKW = (T1.VFDV .* T1.DCOutA./1000);
hold on
t = T1.TIME;
P = T1.Properties.VariableNames(2:end);
for K = 1 : length(P)
fn = P{K};
plot(t, T1.(fn), 'DisplayName', fn);
end
hold off
set(gcf, 'visible', 'on')
legend show

6 comentarios

hello
why not simply do
plot(t+6, T1.(fn), 'DisplayName', fn);
plot(t+seconds(6), T1.(fn), 'DisplayName', fn);
+6 would be adding 6 days.
When trying plot(t+seconds(6), T1.(fn), 'DisplayName', fn); I get the below error
"Data inputs must match the axis configuration. A numeric axis must have numeric data inputs or data inputs which can
be converted to double."
My inputfile contain one line for each 2mS see below (so I want to start with line 3300)
"TIME","DC OUT V","VFD V","STRING1 V","STRING2 V","String 1 A","String 2 A","DC Out A"
+0.000000000E+000,+5.29000E+002,+5.29000E+002,+4.34000E+002,+5.48000E+002,+2.00000E-001,+0.00000E+000,+1.81200E+002
+2.000000000E-003,+5.29000E+002,+5.20000E+002,+4.38000E+002,+5.55000E+002,+2.20000E+000,+8.00000E-001,+1.34200E+002
+4.000000000E-003,+5.30000E+002,+5.31000E+002,+4.42000E+002,+5.53000E+002,+8.00000E-001,+2.00000E-001,+1.77600E+002
+6.000000000E-003,+5.29000E+002,+5.26000E+002,+4.35000E+002,+4.92000E+002,-2.20000E+000,+2.00000E-001,+1.67200E+002
+8.000000000E-003,+5.27000E+002,+5.27000E+002,+4.36000E+002,+4.99000E+002,-1.60000E+000,+6.00000E-001,+1.35600E+002
+1.000000000E-002,+5.30000E+002,+5.27000E+002,+4.40000E+002,+5.71000E+002,+2.00000E+000,+6.00000E-001,+1.81000E+002
Mathieu NOE
Mathieu NOE el 22 de Nov. de 2022
IMHO, t is a numeric array so it should be t+6 and not t+seconds(6)
I am just repeating myself
Walter Roberson
Walter Roberson el 22 de Nov. de 2022
Yes, that does appear to be numeric time in seconds.
Steen
Steen el 23 de Nov. de 2022
thanks it is working with t+6

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Productos

Versión

R2022b

Etiquetas

Preguntada:

el 9 de Nov. de 2022

Comentada:

el 23 de Nov. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by