%% Reorder Inputs Using Position Identifier (n$)
% Reorder the input values using the n$ position identifier.

A1 = 'X';
A2 = 'Y';
A3 = 'Z';
formatSpec = ' %3$s %2$s %1$s';
str = sprintf(formatSpec,A1,A2,A3)

% Copyright 2012 The MathWorks, Inc.