📄 tlist.m
字号:
% [ ]Ok *** TEST ***% of: Test of lists in Matlab.% Sign: Datum:%% *****************************************************************************% RECVAR, A package for new data types in Matlab 4. % (c) FOA 1997. See the file rvright.m for copyright notice.%% A test program for test of lists in Matlab.%% Start : 960930 Svante Bj鰎klund (svabj).% Latest change: $Date: 1997/08/20 13:22:13 $ $Author: svabj $.% $Revision: 2.1 $% *****************************************************************************disp('Test of lists in Matlab.')disp('Don''t forget to compile mex-files before the test.')testnr=input('Choose testno: ');while (isempty(testnr)) testnr=input('Choose testno: ');endmore onif (testnr==30)% *****************************************************************************% [ ] : Test 30% Sign: Datum:%% *****************************************************************************% Comments% [ ]disp('Test 30a')l1 = put1stl(5,[]);l1 = put1stl(6,l1);l1 = put1stl(7,l1);l1 = put1stl(8,l1);showl(l1)% Expected result :% 8% 7% 6% 5% Real result :% [ ]disp('Test 30b')l = makelist(8,7,6,5);l = appendl(l,4);dispr(l)% Expected result :% 8% 7% 6% 5% 4% Real result :% [ ]disp('Test 30c')k = reversel(l);showl(k)% Expected result :% 4% 5% 6% 7% 8% Real result :% [ ]disp('Test 30d')l4 = makelist([1 2; 3 4], 5, 'hej');showl(l4)% Expected result :% [1 2; 3 4]% 5% hej% Real result :elseif (testnr==31)% *****************************************************************************% [ ] : Test 31% Sign: Datum:%% *****************************************************************************% Comments% Test of combined variables with lists, records and multimatrices.% [ ]disp('Test 31a')a = setr([],'name','Tom');a = setr(a,'age',43);b = setr([],'name','Julia');b = setr(b,'age',39);MM = zerosm([2 2 2]);MM = setm(MM,[1 2; 3 4], 1:2, ':', 1);MM = setm(MM,[5 6; 7 8], ':', ':', 2);register = setr([],'Type','Personel register');personlist = makelist(a,b);register = setr(register,'persons',personlist);l5 = makelist(5, 'hej', [1 2; 3 4], [1; 2.5 + 3.75*i],a ,MM ,register);dispr(l5)% Expected result :% All information in the variable l5 shall be shown.% Real result :elseif (testnr==32)% *****************************************************************************% [ ] : Test 32% Sign: Datum:%% *****************************************************************************% Comments% [ ]disp('Test 32a')% Expected result :% Real result :% [ ]disp('Test 32b')% Expected result :% Real result :else disp('Incorrect testnumber.');end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -