Unformatted text preview: % of the min() function. For reference, here is the algorithm from % homework 4 that was used to sort vectors: % % 1) Intialize the output vector to be an empty vector. % 2) Set up a loop to have a number of iterations equal to the % length of the input vector. In other words, if the length of the % input vector was 8, you would need to loop (for/while) 8 times. % For each iteration of the loop, do the following: % a) Find the minimum value and its position in the input vector. % Use the min() function. % b) Concatenate the minimum value to the end of the % output vector. % c) Use the position of this minimum value to remove it from the % input vector. % function S = structSort(A,str) a = A [r c] = size(A) vec = for y = 1:c [v loc] = minStruct(a,str) vec = [vec v] a(:,loc) = [r c] = size(a) end S = vec...
View
Full Document
 Fall '08
 Stallworth
 Sociology, Vector Space, Sort, Ring

Click to edit the document details