?? selectd.m
字號:
% selectd.m
% Scope: This MATLAB macro selects only the different elements from a
% specified array.
% Usage: [xsel,nsel] = selectd(x)
% Description of parameters:
% x - input, columnwise array containing elements to be
% selected
% xsel - output, array containing selected elements, vector with
% nsel elements
% nsel - output, number of elements in the array xsel
% Last update: 04/23/00
% Copyright (C) 1996-00 by LL Consulting. All Rights Reserved.
function [xsel,nsel] = selectd(x)
[nrow,ncol] = size(x);
if (nrow == 1) | (ncol ~= 1)
error('Error in SELECTD.M; check the dimension of the input array');
end
y = sort(x);
nsel = 1;
xsel(1) = y(1);
for k = 2:nrow
if y(k) ~= y(k-1)
nsel = nsel + 1;
xsel(nsel) = y(k);
end
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -