MATLAB: How to create a function that accepts a 3 element vector as input, but returns scalar values

functionhomeworkscalar-outputvector input

I need to create a function that sorts the order of a vector elements and returns it as scalar values.

Best Answer

  • If I understand you correctly, here is an outline of such a function (in a file called sort3.m):
    % Filename sort3.m
    function [a,b,c] = sort3(x)
    % your code for sorting goes here
    a = whatever
    b = whatever
    c = whatever
    You need to fill in the actual sorting code.