Extract headers from CSV and add to app.Items

조회 수: 6 (최근 30일)
LabRat
LabRat 2022년 7월 24일
댓글: Walter Roberson 2022년 7월 27일
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."

채택된 답변

Walter Roberson
Walter Roberson 2022년 7월 24일
편집: Walter Roberson 2022년 7월 24일
header = bud_serials.Properties.VariableNames;
app.SelectTestID.Items = header;
  댓글 수: 4
LabRat
LabRat 2022년 7월 27일
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 2022년 7월 27일
app.SelectTestID.Items = header(2:end);

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by