Random values in timetable
Mostra commenti meno recenti
Hello, first of all I'm quite a Matlab newbie.
My goal is to fill a time table with random values.
Currently, the current value of the loop keeps overwriting the previous value. However, I would like to have all values in one timetable.
n=1
for i = 1:5
Time = datetime('now');
Conductivity = rand(1,1);
pause(n);
data = timetable(Time,Conductivity);
end
Thanks in advance for your help!
Risposta accettata
Più risposte (1)
Turlough Hughes
il 24 Ago 2021
Modificato: Turlough Hughes
il 24 Ago 2021
You can collect the data in the loop and then use timetable
n = 1;
for i = 1:5
Time(i,1) = datetime('now');
Conductivity(i,1) = rand();
pause(n)
end
data = timetable(Conductivity,'RowTimes',Time)
Categorie
Scopri di più su MATLAB in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!