How to save Values in Structure using For Loop and Find the maximum Value from Structure Column

1 visualizzazione (ultimi 30 giorni)
Hello everyone, I hope you are doing well.
I have the following code Which takes the data of shape 1x77564
then we takes 1000 samples using buffer, we apply for loop to the data after that we convert the each shape of 1x1000 to the Images.
the imoriginalestimate is the final output image comes after each loop. The loop runs 78 times means 78 images were created,
In each iteration we apply function DSLEVELFUNCTION1 which gives the PRFValue,NumberofPulses,Levels,maximum,minimum
we want to save the following values (PRFValue,NumberofPulses,Levels,maximum,minimum) in stucture form after each iteration, Then How to find the maximum value of (Levels)
and save other corresponding value of (PRFValue,NumberofPulses,maximum,minimum) which have maximum value of (Levels).
For example in the following data the maximum value of (Levels are 4)
buffered = buffer(incomingdata, 1000);
for K = 1 : size(buffered,2)
thisdata = buffered(:,K);
outputdataset=thisdata.';
%work with thisdata
[numImages, lenImage] = size( outputdataset);
% assuming images are 1000x1000
imbg = false(10000,1000); % background "color"
imfg = ~imbg(1,1); % forground "color"
imSizeOut=[10000 1000]; % ImageSize
for k= 1:numImages
imData = round( outputdataset(k,:)); % get pattern
[~,Y] = meshgrid(1:1000,1:10000); % make a grid
% black and white image
BW = imbg;
BW(Y==imData)=imfg;
valueestimation=imbinarize(imresize(uint8(BW),imSizeOut));
% convert to uint8 (0 255)
valueestimationimage = im2uint8(valueestimation);
% resize (from 1000x1000)
SE=strel('disk',2);
BW=imdilate(BW,SE);
BW=imbinarize(imresize(uint8(BW),imSizeOut));
% convert to uint8 (0 255)
imoriginalestimate = im2uint8(BW);
% imoriginal = flipud(imoriginalestimate);
[PRFValue,NumberofPulses,Levels,maximum,minimum]= DSLEVELFUNCTION1(imoriginalestimate )
end
end

Risposte (0)

Categorie

Scopri di più su Images in Help Center e File Exchange

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by