clear all;clc names = {'A'; 'B'; 'C'; 'D'}; marks = [27; 48; 84; 22]; in_st = {names marks}; in_st = [names num2cell(marks)]; function [op_st1,op_st2] = print_Data(in_st) in_st = in_st; [~,idx] = sort(in_st(:,1)); op_st1 = in_st(idx,:) [~,idx] = sort(in_st(:,2),'descend'); op_st2 = in_st(idx,:)
I want op_st1 in ascending order, and op_st2 in descending order. It works well upto half program, what is the problem in remaining..?
Best Answer