How to find values in structure?
Show older comments
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.
Accepted Answer
More Answers (0)
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!