How to remove zeros using Function in Matlab?
显示 更早的评论
Hi Everybody,
This 1st time I used a Matlab Function, I used it to read two images (Tiff format), one of them has NaN values and 2nd image has Zeros. I want to remove NaN and Zeros rows completely. By the way the output of 1st image is fine but the problem in the output of 2nd image. I have attached the Function and Script.
Thank you in Advance
Reyadh
if true
function [out_image] = img_read_1(input_image,no_data)
%%%out_image ::: this is the name of your out image
%%%input_image ::: this is the name of your input image
%%%fname ::: dir name
IMG_read=imread(input_image);
%image=im2single(IMG_read);
image=IMG_read;
image_reshape=reshape(image,1,size(image,1)*size(image,2));
image_t=image_reshape';
out_image=image_t;
out_image(find(out_image(:)<=no_data)) = NaN;
out_image=out_image(~isnan(out_image(:)),:);
end
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Image Arithmetic 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!