⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nano2write.m

📁 matlab处理图像的一些基本方法。其中有一部分mex程序需要安装编译
💻 M
字号:
function  [count, errmsg]= nano2write(filename, header, img)%NANO2WRITE  Write the header and the image to a nanoscope 2 file.%%       [COUNT, ERRMSG] = NANO2WRITE(FILENAME, HEADER, IMAGE)%%       Return the number of elements successfully written.%              and an error message if occour.%%       Before to write the file, the image is -90 degree%    rotated and the bytes are flipped in order to be%    compatible with the nanoscope.%%%       Claudio  October 11, 1995.%% Copyright (c) 1995 by Claudio Rivetti and Mark Young% claudio@alice.uoregon.edu,    mark@alice.uoregon.edu%global Original_NANO2_headerHEADER_SIZE_NS2 = 2048;fp = fopen(filename, 'w');if fp == -1    errmsg='Can not create file';    return;endimg=rot90(img, -1);h=Original_NANO2_header;h=setparameter(h, 'num_samp', size(img,1));h=setparameter(h, 'scan_sz', scansize(header));h=setparameter(h, 'text', getparameter(header, 'Note',1));h=strrep(h, ': ', ' = ');h=strrep(h, [13 10 92], [13 10]);h=h(3:length(h));hlen=length(h);if hlen > HEADER_SIZE_NS2  h=h(1:HEADER_SIZE_NS2);else  h=[h zeros(1,HEADER_SIZE_NS2-hlen)]; endcount_header = fwrite(fp, h', 'char');count_img    = fwrite(fp, img, 'short', 'vaxd');em=ferror(fp, 'clear');fclose(fp);count = prod(size(h)) + prod(size(img));if count ~= count_header + count_img    errmsg=em;endreturn

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -