retrieving data from structure

조회 수: 11 (최근 30일)
DoVile Last Name:
DoVile Last Name: 2016년 11월 16일
답변: KSSV 2016년 11월 16일
I am having a weird issue when trying to get data from a structure.
I am using dir to get folder names into the variable FolderNames, I then need to extract the names from there, eg. via.
FolderNames.name{1}
or something? (I have been away from coding for a little while), but I keep running intro trouble. When I run the above code it says "Expected one output from a curly brace or dot indexing expression, but there were 21 results.". But I dont know how to get only result 1 (or 2 or 3, etc.)
  댓글 수: 1
DoVile Last Name:
DoVile Last Name: 2016년 11월 16일
Solution: Put the structure into a table and access the table.
FolderData = struct2table(dir); FolderNames = FolderData(3:end,1);

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

채택된 답변

KSSV
KSSV 2016년 11월 16일
Try
FolderNames(1).name

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by