MATLAB: How to save values in array or in .mat file by ascending order

.mat filearrayascending order

for i=1:10
j(i)=i*0.5:
end
save('j.mat', 'j')
how can i save values in array or in .mat file by ascending order?

Best Answer

j = sort( j );
save( 'j.mat', j );
In your example they would already be in ascending order though.