Comparision of data names

조회 수: 1 (최근 30일)
Veilchen1900
Veilchen1900 2017년 5월 7일
댓글: Veilchen1900 2017년 5월 9일
Hi, I want to read images into the workspace and compare the image names with the image names stored in a cell array. My aim is to get the row from the cell aray where the image names are identical. The cell array contains data from an excelsheet (first column = name of image, second-fifth columns = values). With the code below I only get the name of the first image in dir. How do I get the position of the second, third,..image (stored in dir) from the cell array? Thanks in advance.
My code:
files = dir('*.tiff');
a=files.name
t={a}
[rn,cn]=find(strcmp(CellArray,t))

채택된 답변

Jan
Jan 2017년 5월 8일
편집: Jan 2017년 5월 8일
t = {files.name};
[Lia, Locb] = ismember(CellArray, t);
Or perhaps:
[Lia, Locb] = ismember(CellArray(:, 1), t);
Maybe:
[Common, Index] = intersect(CellArray(:, 1), t);
  댓글 수: 1
Veilchen1900
Veilchen1900 2017년 5월 9일
Thank you for your help.

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by