Help with MATLAB problem

13 次查看(过去 30 天)
john doe
john doe 2016-11-11
编辑: per isakson 2016-11-11
The problem is listed below. If anyone could provide me some guidance, I would greatly appreciate it, I kind of don't know where to start!
*"Create a new script file called LASTNAME_LAB6_problem4.m. Again, begin by printing both your name and a title at the beginning of code using the DISP command.
A vector is given by
x=[4.5 5 -16.12 21.8 10.1 -16.11 5 14 -3 3 2]
Using conditional statements and loops, write a program that implements “Selection Sort” to rearrange the elements of x in order from the smallest to the largest. Do NOT use MATLAB’s built-in function sort().
Selection Sort Suppose x is an array of n values. We want to sort x in ascending order. That is, x[1] should be the smallest and x[n] should be the largest. The idea of Selection Sort is that we repeatedly find the smallest element in the unsorted part of the array and swap it with the first element in the unsorted part of the array. "*
  1 个评论
Guillaume
Guillaume 2016-11-11
By help you mean "do it for me because I can't be bothered and I'd rather cheat on my assignment"?
Otherwise, you would be asking a specific question about the attempt that you made.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by