필터 지우기
필터 지우기

select, only once, the names present in a struct

조회 수: 1 (최근 30일)
Alberto Acri
Alberto Acri 2023년 6월 14일
편집: Stephen23 2023년 6월 14일
I have the following struct. Is it possible to select, only once, the names in the 'SeriesDescription' column? So I would need to create, in this case, a struct or table consisting only of: 'Scout', 'Serie', 'standard'.

채택된 답변

Stephen23
Stephen23 2023년 6월 14일
편집: Stephen23 2023년 6월 14일

추가 답변 (1개)

Les Beckham
Les Beckham 2023년 6월 14일
S.Number = compose('%04d', 0:16)'; % create test data since you only included a picture of your data
desc = {'Scout'; 'Scout'; 'Scout'};
for i = 4:13
desc{i} = 'Serie';
end
for i = 14:17
desc{i} = 'standard';
end
S.SeriesDescription = desc;
% Now, extract the unique elements of SeriesDescription and create a table
T = table(unique(S.SeriesDescription), 'VariableNames', {'SeriesDescription'})
T = 3×1 table
SeriesDescription _________________ {'Scout' } {'Serie' } {'standard'}

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by