Difference between revisions of "Program Examples:Sci Lab interface/zh-hans"

From SoftMC-Wiki
Jump to: navigation, search
(Created page with "{{Languages}} Example for function of reading softMC record file from SciLab (64bit). <syntaxhighlight lang="scilab"> global rec rec = []; function MCplot(name) global rec...")
 
 
Line 1: Line 1:
{{Languages}}
+
{{Languages|Program_Examples:Sci_Lab_interface}}
Example for function of reading softMC record file from SciLab (64bit).
+
从SciLab(64位)读取softMC记录文件的功能示例。
 
 
 
<syntaxhighlight lang="scilab">
 
<syntaxhighlight lang="scilab">
  
Line 29: Line 28:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
* 32bit version is the same just instead "i" identifier in '''''mget''''' the "l" identifier is used.
+
* 32位版本是相同的,而是在'''''mget'''''中将"i"标识符替换为"l"标识符使用。
  
The function is invoked as (draws 3D trajectory) :
+
该函数被调用为(绘制3D轨迹) :
  
 
<syntaxhighlight lang="vb">
 
<syntaxhighlight lang="vb">

Latest revision as of 07:34, 17 July 2017

语言: 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));