How do I modify the given code to work on specific trials containing a specific key string?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Kevin Akash Rajasekaran
el 5 de Jun. de 2021
Comentada: Kevin Akash Rajasekaran
el 5 de Jun. de 2021
Hey all! I'm working on a project where I am analysing data from a .mat file. The file in question contains information for a specific number of trials from the experiment, where each trial is for a different image from a database, represented by a key. All the keys for a file are present in the following class "d.meta.image.filename" and I can retrieve said information about the keys using the following command.
tmp = d.meta.image.filename('time',Inf).data;
which gives tmp as a 1 x n cell array. Each cell contains a 1 x 1 struct with the relevant information as shown below:
key 'cps201410017278'
meta 1x1 struct
ppm '/home/marmolab/UT Natural Images/Human Made Scene Collection - Set 1/cps201410067326.ppm'
exif '/home/marmolab/UT Natural Images/Human Made Scene Collection - Set 1/exif/cps201410017278.exif'
How do I go about selecting all possible trials in a file, for one specific key? I'm thinking somehing like
myTrials = find(keys == tmp('cps201410017278'))
after defining tmp as above. Thanks in advance!
0 comentarios
Respuesta aceptada
Walter Roberson
el 5 de Jun. de 2021
Editada: Walter Roberson
el 5 de Jun. de 2021
keys = cellfun(@(C) C.key, tmp, 'uniform', 0);
matches = strcmp(keys, 'cps201410017278');
tmp_subset = tmp(matches);
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Type Conversion en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!