Insert data to table
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Indrani
el 24 de Oct. de 2023
Comentada: Indrani
el 26 de Oct. de 2023
Hi,
I have a table temps with 2 columns of type DateTime and Double. In the Double column of the table, I have manually inserted from values (the first 90 rows). I want to populate the next rows of the Double column with values from a different table which has only 1 column.
How do I proceed?
Thanks!
0 comentarios
Respuesta aceptada
Voss
el 24 de Oct. de 2023
temps = table(datetime(rand(10,1),'ConvertFrom','datenum'),rand(10,1))
a_different_table = table([1;2;3;4;5])
start_row = 6;
temps{start_row+(0:size(a_different_table,1)-1),2} = a_different_table{:,1}
3 comentarios
Voss
el 24 de Oct. de 2023
Editada: Voss
el 24 de Oct. de 2023
"I do not want a separate column Var3. Is it possible to enter values of table T2 in the column Var2, after the last value of table T1?"
Using the code from my answer and setting the start_row to be size(T1,1)+1, i.e., start right after the last value of T1.
T1 = table(datetime(rand(7,1),'ConvertFrom','datenum'),rand(7,1))
T2 = table([1;2;3])
start_row = size(T1,1)+1;
T1{start_row+(0:size(T2,1)-1),2} = T2{:,1}
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!