⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 selectd.m

📁 GPS software toolbox for GPS receiver development
💻 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 + -