Comparision of data names

4 vues (au cours des 30 derniers jours)
Veilchen1900
Veilchen1900 le 7 Mai 2017
Commenté : Veilchen1900 le 9 Mai 2017
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))

Réponse acceptée

Jan
Jan le 8 Mai 2017
Modifié(e) : Jan le 8 Mai 2017
t = {files.name};
[Lia, Locb] = ismember(CellArray, t);
Or perhaps:
[Lia, Locb] = ismember(CellArray(:, 1), t);
Maybe:
[Common, Index] = intersect(CellArray(:, 1), t);
  1 commentaire
Veilchen1900
Veilchen1900 le 9 Mai 2017
Thank you for your help.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by