Program Examples:Sci Lab interface/zh-hans

From SoftMC-Wiki
Jump to: navigation, search
语言: English  • 中文(简体)‎

从SciLab(64位)读取softMC记录文件的功能示例。

global rec 
rec = [];

function MCplot(name)
global rec
     fid = mopen(name,'rb');
     n   = mget(1,'i',fid);
     m   = mget(1,'i',fid);
     gap = mget(1,'i',fid);
     vlen= mget(1,'i',fid);
     var = mgetstr(vlen,fid);
     n = modulo(n,16);
     rec = zeros(m,n);
          
     for i = 1:m
       for j = 1:n
     	 tmp = mget(1,'d',fid);
     	 rec(i,j) = tmp;
     	end
     end
     mclose(fid);
endfunction
  • 32位版本是相同的,而是在mget中将"i"标识符替换为"l"标识符使用。

该函数被调用为(绘制3D轨迹) :

MCplot('C:\SoftMC\Projects\test.rec')
parm3d(rec(:,1),rec(:,2),rec(:,3));