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

📄 test_sort.m

📁 matlab宝典,电子工业出版社,包含该书的源码4-6章
💻 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 + -