📄 test_sort.m
字号:
% Script file test_sort.m
%
% Purpose:
% To read in an input data set,sort it into ascending order
% using the selection sort algorithm,and to write the sorted dat
% to the command window.
% This program calls function "ssort" to do the actual sorting.
nvals=input('Enter number of the numbers to sort:');
array=zeros(1,nvals);
for ii=1:nvals
string=['Enter value ' int2str(ii) ':'];
array(ii)=input(string);
end
sorted=ssort(array);
fprintf('\n sorted data:\n');
for ii=1:nvals
fprintf('%8.4f\n',sorted(ii));
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -