MATLAB: Output

a(0)

for example my output: 20 30 40 50 I want to convert —————> A(0)=20 <————— A(1)=30 A(2)=40 A(3)=50 how can I make this??

Best Answer

A = [20 30 40 50];
fprintf(1, 'A(%d)=%d ', [(0:length(A)-1).' ; A(:)].' );
fprintf(1, '\n');