📄 sigswapdim.m
字号:
function sigOut = sigswapdim(sigIn, dim1, dim2)%SIGSWAPDIM Swaps two dimensions in a radar signal.%%--------%Synopsis:% sigOut = sigswapdim(sigIn, dim1, dim2)%%Description:% Swaps two dimensions in a radar signal.%%Output and Input:% sigOut (RxRadarSigT) : Radar signal after dimension split.% sigIn (RxRadarSigT) : Radar signal before dimension split.% dim1,dim2 (IntScalarT): The index of the dimensions to swap.%%--------%Notations:% Data type names are shown in parentheses and they start with a capital% letter and end with a capital T. Data type definitions can be found in [1]% or by "help dbtdata".% [D] = This parameter can be omitted and then a default value is used.% When the [D]-input parameter is not the last used in the call, it must be% given the value [], i.e. an empty matrix.% ... = There can be more parameters. They are explained under respective% metod or choice.%%Examples:% s = RxRadarSigT;% s.signals = ones([4 6 8 1 1]);% s2 = sigswapdim(s,1,2);% size(s2.signals)%% ans = % 6 4 8 1 1 %%Software Quality:% (About what is done to ascertain software quality. What tests are done.)% This function has been tested by test 103 in the test script "tdbt.m".%%Known Bugs:% Maybe the updating of the fields "waveform", "pulIx", "ranIx" etc. in% the output radar signal is incorrect. They are always assigned vectors% whose values start with one.%%References:% [1]: Bj鰎klund S.: "DBT, A MATLAB Toolbox for Radar Signal Processing.% Reference Guide", FOA-D--9x-00xxx-408--SE, To be published.%%See Also:% sigsize sigsplitdim, msigmat2 sigsubix% * DBT, A Matlab Toolbox for Radar Signal Processing *% (c) FOA 1994-2000. See the file dbtright.m for copyright notice.%% Start : 991016 Svante Bj鰎klund (svabj).% Latest change: $Date: 2000/10/16 15:21:50 $ $Author: svabj $.% $Revision: 1.2 $% *****************************************************************************% ----------------------------------------------------------------------- %% Handle input parameters% ----------------------------------------------------------------------- %arginNo=3;if (nargin < arginNo) error('DBT-Error: To few input parameters.')endarginNo = arginNo +1;% ****************** Add missing input parameters ******************%if (nargin < arginNo)% method = [];%end% ****************** Default values ******************%if isempty(method)% method = [];%end%if% ****************** Error check input parameters ******************chkdtype(sigIn, 'RxRadarSigT')chkdtype(dim1, 'IntScalarT')chkdtype(dim2, 'IntScalarT')sizeSpec = sizem(sigIn.signals);% ****************** Create output variable ******************sigOut = sigIn;% ----------------------------------------------------------------------- %% RxRadarSigT: Radar signals.% ----------------------------------------------------------------------- % % ****************** Swap dimensions ****************** maxDim = 6; dims = 1:maxDim; newDims = swap(dims, dim1, dim2); sigOut.signals = permute(sigIn.signals, newDims); % ****************** Update size information ****************** ss = sizem(sigOut.signals); sigOut.waveform.noPulses = ss(1); sigOut.waveform.noCPI = ss(5); if ((dim1 == 2) | (dim2 == 2)) dbtwarning('The contents of "sigOut.waveform" will be incorrect.') % Because "waveform.noRangeBins" is not updated. Should it be updated? end%if% if isfield(sigIn,'spaIx')% sigOut.pulIx = sigIn.pulIx(1:ss(1));% sigOut.ranIx = sigIn.ranIx(1:ss(2));% sigOut.spaIx = sigIn.spaIx(1:ss(3));% end%ifsigOut.pulIx = [];sigOut.ranIx = [];sigOut.spaIx = [];sigOut.extraIx = [];sigOut.cpiIx = [];sigOut.trialIx = [];%sigOut, setsigix(sigOut, dim1, getsigix(sigIn, dim2);%sigOut, setsigix(sigOut, dim2, getsigix(sigIn, dim1);%endfunction sigswapdimfunction vectorOut = swap(vectorIn, index1, index2) tmp = vectorIn(index1); vectorIn(index1) = vectorIn(index2); vectorIn(index2) = tmp; vectorOut = vectorIn;%endfunction swap
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -