Converting idl to matlab and error in code
Show older comments
Hi, I'm trying to convert IDL codes to matlab, the idea is i have dark images and flat images and i'm trying to select them both for another section of the code
I'm stuck on the idl function known as FLOAT
IDL codes
flatlist = file_search(workdir,'flat*')
nflat = n_elements(flatlist)
darklist = file_search(workdir,'dark*')
ndark = n_elements(darklist)
dark = fltarr(xsize,ysize)
flat = fltarr(xsize,ysize)
for k = 0,ndark-1 do begin
imtemp = read_tiff(darklist(k))
dark = dark+float(imtemp)/ndark
;Average dark images
endfor
Matlab version
[darklist,workdir] = uigetfile({'*.jpg;*.tif;*.png;*.gif','All Image Files';...
'*.*','All Files'},'Select the dark image(s)','MultiSelect', 'on');
if(~iscell(darklist))
ndark=1;
else
ndark = numel(darklist);
end
dark = zeros(ysize,xsize);
flat = zeros(ysize,xsize);
for k = 1:ndark
if(~iscell(darklist))
imtemp = imread(darklist);
else
imtemp = imread(darklist{k});
dark = dark+double(imtemp)./ndark;
end
end
I'm not sure if its double, also i'm getting this error
Error in
imtemp = imread(darklist{k});
help pls
Thanks
Accepted Answer
More Answers (0)
Categories
Find more on Convert Image Type 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!