Difference between revisions of "Program Examples:Sci Lab interface"
(Created page with "Example for function of reading softMC record file from SciLab (64bit). <syntaxhighlight lang="scilab"> global rec rec = []; function MCplot(name) global rec fid = mo...") |
|||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
+ | {{Languages|Program_Examples:Sci_Lab_interface}} | ||
Example for function of reading softMC record file from SciLab (64bit). | Example for function of reading softMC record file from SciLab (64bit). | ||
Line 35: | Line 36: | ||
MCplot('C:\SoftMC\Projects\test.rec') | MCplot('C:\SoftMC\Projects\test.rec') | ||
− | + | param3d(rec(:,1),rec(:,2),rec(:,3)); | |
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 12:58, 25 March 2018
Language: | English • 中文(简体) |
---|
Example for function of reading softMC record file from SciLab (64bit).
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
- 32bit version is the same just instead "i" identifier in mget the "l" identifier is used.
The function is invoked as (draws 3D trajectory) :
MCplot('C:\SoftMC\Projects\test.rec')
param3d(rec(:,1),rec(:,2),rec(:,3));