Extract headers from CSV and add to app.Items

6 visualizaciones (últimos 30 días)
LabRat
LabRat el 24 de Jul. de 2022
Comentada: Walter Roberson el 27 de Jul. de 2022
I would like to take the first row of a csv file (headers) and add those to a dropdown menu item. I tried something like this:
bud_serials = readtable(annotation);
header = bud_serials(1:1, :)
app.SelectTestID.Items = {header};
I get an error: "'Items' must be a 1-D cell array of character vectors or a string array."

Respuesta aceptada

Walter Roberson
Walter Roberson el 24 de Jul. de 2022
Editada: Walter Roberson el 24 de Jul. de 2022
header = bud_serials.Properties.VariableNames;
app.SelectTestID.Items = header;
  4 comentarios
LabRat
LabRat el 27 de Jul. de 2022
Is there a way to automatically take as many header columns as is available? Each csv file will have a different number of header columns.
Walter Roberson
Walter Roberson el 27 de Jul. de 2022
app.SelectTestID.Items = header(2:end);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Large Files and Big Data en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by