write data of textfile with different amount of value in cell array

1 visualización (últimos 30 días)
Hello everyone,
I wanted to ask if there is a possibility to create a matrix/cell array with different amount of rows? I'm trying to get the fourth column of the attached files into one matrix/cell array, but it doesn't work.
here is my attempt:
irl = readtable("min_vel12_halfpi.txt");
z_irl_temp = irl{:,4};
z_irl{:,1} = z_irl_temp;
irl = readtable("min_vel12_1pi.txt");
z_irl_temp = irl{:,4};
z_irl{:,2} = z_irl_temp;
irl = readtable("min_vel12_2pi.txt");
z_irl_temp = irl{:,4};
z_irl{:,3} = z_irl_temp;
irl = readtable("min_vel12_4pi.txt");
z_irl_temp = irl{:,4};
z_irl{:,4} = z_irl_temp;
irl = readtable("min_vel12_8pi.txt");
z_irl_temp = irl{:,4};
z_irl{:,5} = z_irl_temp;
but I keep getting this error code:
Unable to perform assignment because brace indexing is not supported for variables of this type.
How can I solve this problem? Thanks for your ideas and your help!
  1 comentario
Sam
Sam el 1 de Jul. de 2021
Matrices can't be used for different row sizes. Use cell array to do so.
z_irl = cell(1,5);
irl = readtable("min_vel12_halfpi.txt");
z_irl_temp = irl{:,4};
z_irl{1,1} = z_irl_temp;
%similarly add values for z_irl{1,2}, z_irl{1,3}, z_irl{1,4} and so on

Iniciar sesión para comentar.

Respuesta aceptada

Sam
Sam el 1 de Jul. de 2021
Matrices can't be used for different row sizes. Use cell array to do so.
z_irl = cell(1,5);
irl = readtable("min_vel12_halfpi.txt");
z_irl_temp = irl{:,4};
z_irl{1,1} = z_irl_temp;
%similarly add values for z_irl{1,2}, z_irl{1,3}, z_irl{1,4} and so on

Más respuestas (0)

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by