How to find values in structure?
Afficher commentaires plus anciens
Hi, I loaded some .tif files into Matlab like this:
D = 'my path';
S = dir(fullfile(D,'*.tif'))
for k = 1:numel(S);
F = fullfile(D,S(k).name);
S(k).data = imread(F);
end
And I'm trying to get selected values from these .tif files. When I had only one file loaded (as a single array, not into structure), I could do this:
Regions=imread('RegionsFile.tif');
FirstParameterDate=imread('FirstParameterDate.tif');
SecondParameterDate=imread('SecondParameterDate.tif');
x=find(Regions==5);
MyRegionFirstParameter=FirstParameterDate(x);
MyRegionSecondParameter=SecondParameterDate(x);
Answer=find(MyRegionFirstParameter>=2&MyRegionSecondParameter<5);
But I don't know how to find values in .tif files loaded into structure like this?
This:
x=find(Regions==5);
MyRegionFirstParameter(:).data=find(S(:).data==x);
or
MyRegionFirstParameter(1).data=S(1(x)).data;
is not working.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Structures dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!