MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by chathura
on 11 May 2013

e.g., from 7465 :

The digits = 7, 4, 6, and 5, so:

Minimum = 4567, the maximum = 7654

*No products are associated with this question.*

Answer by Iman Ansari
on 12 May 2013

Accepted answer

Hi.

A=7465; A=num2str(A)'; Minimum=str2num(sort(A)') maximum=str2num(sort(A,'descend')')

chathura
on 13 May 2013

if it is necessary, to program counted how many of these steps need to do to get the number 6574, how can I do this with that....

Iman Ansari
on 13 May 2013

A=7465; A=num2str(A)'; A_sort=sort(A); New=str2num([A_sort([3 2 4 1])]')

## 0 Comments