MATLAB: From four different numbers, how can I find out the minimum and maximum numbers that can created from the digits e.g., from 7465 : The digits = 7, 4, 6, and 5, so: Minimum = 4567, the maximum = 7654 Best Answer Hi.A=7465;A=num2str(A)';Minimum=str2num(sort(A)')maximum=str2num(sort(A,'descend')') Related SolutionsMATLAB: Comparing numbers K = randi(200,80,1);out = reshape(K,[],8);for i1 = 1:size(out,2) A = out(:,i1); i2 = 1; while numel(A) s = A(1); for j1 = 2:numel(A) if s > A(j1) k = A(j1); A(j1) = s; s = k; end end out(i2,i1) = s; A = A(2:end); i2 = i2 + 1; endendout = out(:); MATLAB: Trimming numbers A = [3829 36203 371];% Robust to different 'lengths'fix(A ./ 10.^(ceil(log10(abs(A)))-2)) Related QuestionRandom numbersRandom numbersJoin numbers in vectorAdd specific numbers to a plot
Best Answer