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

Ameer Hamza
Ameer Hamza le 4 Oct 2020
Like this
MyRegionFirstParameter(1).data(x) = S(1).data(x);

2 commentaires

Izabela Wojciechowska
Izabela Wojciechowska le 4 Oct 2020
Thank you, it works.
Ameer Hamza
Ameer Hamza le 5 Oct 2020
I am glad to be of help!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by