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 Center および File ExchangeFile Operations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by