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

📄 setpaths4test_ber.m

📁 OFDMA 物理层开发的matlab 源码.飞思卡尔提供.对物理层开发的工程师有帮助!
💻 M
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Property of Freescale
%  Freescale Confidential Proprietary
%  Freescale Copyright (C) 2005 All rights reserved
%  ----------------------------------------------------------------------------
%  $RCSfile: setPaths4test_BER.m.rca $
%  Tag $Name:  $
%  $Revision: 1.10 $
%  $Date: Thu Feb  1 08:58:20 2007 $
%  Target: Matlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Adds Paths and save them to pathdef.m
% In order to avoid relative paths.
% In order to avoid many "addpath" and "rmpath".
%
% setPaths4test_BER(option)
% option is optional ('on' or 'off')
%    default is 'on'
%
% Freescale 2006
% Beta Version by VM

%-- Matlab files used by this file
% mFindRevision
%-- End of list

function status = setPaths4test_BER(option)

clc

if ~exist('option')
    option='on';
end

%-- Check current directory is the good one
location = '             ';
location = pwd;
% We might have some pb here with non-European sets of characters
if ~(all(location(end-11:end)== 'SP\CM\matlab') | all(location(end-11:end)== 'SP/CM/matlab') )
    status = -1;
    error(['To be Executed from "...SBX\SP\CM\matlab". Current directory is:' location ])
end


switch option
    case 'off'
        status=restore;
    case 'on'
        status(1)=restore;
        status(2)=addCustomPaths;
    otherwise
        error('unknown argument')
end



%--------------------------------------------------------------------------
function status = restore
%-- Restores default paths
disp(' ')
disp('Restoring default paths...')

if strncmp(computer,'PC',2)
    sep=';';
else %UNIX
    sep=':';
end
status=1;

%-- delete custom path
%-- nota: the following has been done because "restauredefaultpath"
%didnt work OK

s = matlabpath;
r = matlabroot;
p = 1;
keepOn = 1;
N=10;

while keepOn
    t = strtok(s(p:end), pathsep);
    %disp(sprintf('%s', t))
    p = p + length(t) + 1;
    if isempty(strfind(s(p:end),sep)) break, end;
    if size(t,2)>=N
        if t(1:N)==r(1:N) %this is a default Matlab path
            %do nothing, keep
            keepOn=0;
        else
            %remove path
            disp(sprintf('Removing path: %s', t))
            rmpath(t)
        end

    else
        %remove path
        disp(sprintf('Removing path: %s', t))
        rmpath(t)
    end
end



%--------------------------------------------------------------------------


%--------------------------------------------------------------------------
function status = addCustomPaths
%-- Adds customs path for test_BER
disp(' ')
disp('Now Adding Custom directories ...')


%-- Find location of the SBX folder
cd ../../..
locationSBX = pwd ;
cd SP/CM/matlab

%-- Add the desired /MATLAB folders here:
myPaths = {
    %SP CM
    '/SP/CM'                                %CM matlab files

    %UP/DL
    '/SP/UP/DL/SPKernel/CodeBlkSeg'         %CodeBlkSeg
    '/SP/UP/DL/SPKernel/Rand'               %Randomizer
    '/SP/UP/DL/SPKernel/Punct'              %Puncturing
    '/SP/UP/DL/SPKernel/ConvEnc'            %Conv Encoder
    '/SP/UP/DL/SPKernel/IL'                 %IL
    '/SP/UP/DL/SPKernel/SlotSeg'            %SlotSeg
    '/SP/UP/DL/SPKernel/ModMap'             %ModMap
    '/SP/UP/DL/SPKernel/RepSlotMap'         %RepSlotMap
    '/SP/UP/DL/SPKernel/CTC/RSCEnc'         %CTC 
    '/SP/UP/DL/SPKernel/CTC/Grouping'
    '/SP/UP/DL/SPKernel/CTC/CTCEnc'
    '/SP/UP/DL/SPKernel/CTC/IL'
    '/SP/UP/DL/SPKernel/CTC/SubBlockIL'
     
    '/SP/UP/DL/SPManager'                   %HARNESSES UP/DL

    %FP/DL
    '/SP/FP/DL/SPKernel/SbcRandomizer'      %SbcRandomizer
    '/SP/FP/DL/SPKernel/DataMod'            %DataModulation
    '/SP/FP/DL/SPKernel/DlTableGen'         %DlTableGen
    %'/SP/FP/DL/SPKernel/GenDlTable'         %GenDlTable
    '/SP/FP/DL/SPKernel/MapDL'              %MapDL
    '/SP/FP/DL/SPKernel/PrbsGen'            %PrbsGen
    '/SP/FP/DL/SPKernel/PreambleGen'        %PreambleGen
    '/SP/FP/DL/SPKernel/SbcPermutation'     %SbcPermutation
    '/SP/FP/DL/SPKernel/CarrierScrambler'   %CarrierScrambler
    '/SP/FP/DL/SPManager'                   %HARNESSES FP/DL

    %TP/DL
    '/SP/TP/DL/SPKernel/GuardInsertAndWrap' %GuardInsertAndWrap
    '/SP/TP/DL/SPKernel/CPInsertion'        %CPInsertion
    '/SP/TP/DL/SPManager'                   %HARNESSES TP/DL

    %UP/UL
    '/SP/UP/UL/SPKernel/CodeBlkDeseg'       %CodeBlkDeseg
    '/SP/UP/UL/SPKernel/DerepSlotDemap'     %DerepSlotDemap
    '/SP/UP/UL/SPKernel/DeRand'             %DeRandomizer
    '/SP/UP/UL/SPKernel/Viterbi'            %Viterbi decoder
    '/SP/UP/UL/SPKernel/DePunct'            %DePuncturing
    '/SP/UP/UL/SPKernel/DIL'                %DeInterLeaver
    '/SP/UP/UL/SPKernel/Derep'              %Derep
    '/SP/UP/UL/SPKernel/SlotDeseg'          %SlotDeseg
    '/SP/UP/UL/SPKernel/CTC/CTC_dec'        %CTC
    '/SP/UP/UL/SPKernel/CTC/MAPDec'
    '/SP/UP/UL/SPKernel/CTC/ILDIL'
    '/SP/UP/UL/SPKernel/CTC/DeGrouping'
    '/SP/UP/UL/SPKernel/CTC/RSCDec'
    '/SP/UP/UL/SPKernel/CTC/subBlockDIL'
    '/SP/UP/UL/SPManager'                   %HARNESSES UP/UL

    %FP/UL
    '/SP/FP/UL/SPKernel/SlotExtraction'     %SlotExtraction
    '/SP/FP/UL/SPKernel/SlotMeasurement'    %SlotMeasurement
    '/SP/FP/UL/SPKernel/CEIntraTile'        %CEIntraTile
    '/SP/FP/UL/SPKernel/EqZF'               %EqZF
    '/SP/FP/UL/SPKernel/MRC'                %MRC
    '/SP/FP/UL/SPKernel/DemodMap'           %DemodMap
    '/SP/FP/UL/SPKernel/DemodMapperMinDist' %DemodMap min dist algo
    '/SP/FP/UL/SPKernel/DataDemodulation'   %DataDemodulation
    '/SP/FP/UL/SPKernel/MapUL'              %MapUL
    '/SP/FP/UL/SPKernel/GenerateULTable'    %GenerateULTable
    '/SP/FP/UL/SPManager'                   %HARNESSES FP/UL

    %TP/UL
    '/SP/TP/UL/SPKernel/GuardRemoveAndWrap' %Remove guards
    %'/SP/TP/UL/SPKernel/CPRemoval'          %CP removal
    '/SP/TP/UL/SPKernel/RemoveCP'           %RemoveCP
    '/SP/TP/UL/SPKernel/ChannelModel'       %ChannelModel
    '/SP/TP/UL/SPManager'                   %HARNESSES TP/UL

    %UP/CM
    '/SP/UP/CM/Utilities'                   %Common files for UP
    '/SP/UP/CM/CTC'                          %CTC
    
    %FFT & IFFT
    '/SP/CM/SPKernel/FFT'                  %FFT & IFFT

    %mULCodeBlockSeg 
    '/Manager/UL/ULCodeBlockSeg' 
    
    
    };


%-- Loop over myPaths
for i=1:size(myPaths,1)
    t=[locationSBX myPaths{i,1} '/matlab' ] ;
    disp(['Adding path: ' t ])
    addpath(t)
end


%-- Save Paths into pathdef.m
%nota: handle with care
savepath

%-- Create report
disp(' ')
s=FindRevision('setPaths4test_BER.m');
file = ['matlabPathStatusReport.txt'];
if exist(file) 
    delete(file)
    disp(['Updating ' file])
else
    disp(['Creating ' file]) 
end
fid=fopen(file,'w');
fprintf(fid,s);
status = fclose(fid); % close file other access might be denied next time

status = 1;




%--------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -