Filter löschen
Filter löschen

How to perform algebraic operations on an hyper stack image?

1 Ansicht (letzte 30 Tage)
ct8
ct8 am 14 Feb. 2023
Kommentiert: ct8 am 3 Mär. 2023
I have sets of images in folders A,B, ... containing images of dimension (n x m).
How do I group the images and then perform one operation to get outputs A',B',.. where A' = (A-X)/X [X is another image of dimensions (n x m)]

Akzeptierte Antwort

Yuvraj Singh
Yuvraj Singh am 22 Feb. 2023
Hi,
Below mentioned code takes all the files from a folder and save it to a matrix for matrix opeartion.
%chanage directory to the folder of your interest
cd /path_to_folder_of_interest
%lists all files/folders in the diretory
x = dir;
%iteerate over all files/folders inside a folder
for idx = 1:numel(x)
element = x(idx);
%checks if its not a directoey it will read from excel file and make it
%a matric for operation
if(~element.isdir)
if(exist("A","var"))
A = [A;table2array(readtable(element.name))];
else
A = table2array(readtable(element.name));
end
end
end
A1 = (A-X)/X;
It assumes all the file are excel files in the folder.

Weitere Antworten (0)

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by