📄 xscrambl.m
字号:
function xscram=xscrambl(x)
% xscram=xscrambl(x)
% scrambles a data file using uniform random numbers to generate indices
% works with vectors only
%
% This program is distributed as a supplement to the book
% "Biomedical Signal Processing and Signal Modeling" by E. N. Bruce,
% published by Wiley, 2000. It is provided for educational use only.
% While every effort has been made to insure its suitability to illustrate
% principles described in the above book, no specific feature or capability
% is implied or guaranteed.
xscram=zeros(size(x));
xtmp=x;kl=length(x);ran1=zeros(100,1);
rand('seed',sum(100*clock));
for j=1:kl
win=0;
while j ~= kl+1 & win == 0
ran1=rand(100,1); indx=max([round(99*rand),1]);
ran2=ran1(indx,1);
ix=round(kl*ran2);
if ix <= kl & ix > 0
if xtmp(ix) ~= -9999
xscram(j)=xtmp(ix);
xtmp(ix)=-9999;
win=1;
end
end
end % of while loop
end % of main for loop
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -