www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/ReorderInputsUsingPositionIdentifiernExample.m

    %% 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)