MATLAB: How to add multiple indices to graph title, legend, and output image

exportfprintfgraphindexingMATLABtitle

Motivation: I want to automatize the loading, processing and output of multiple data. Indices such as i, j, k, etc… are used to distinguish them. The output should have the same input indices.
Example: For the case of one data (graph and output image), I have the following command lines:
i=5;
f=figure(i);
x = 0:pi/100:2*pi;
y = sin(x-i);
h=plot(x,y);
legend(h,sprintf('sin(x-%d)',i),1);
title(['GRAPH\_',num2str(i)]);
print(f,'-dtiff', ['IMAGE_',num2str(i)]);
PROBLEM: I have multiple indices and I want that all of them be part of graph title and image name, so I changes the lines above intuitively to:
i=5;
j=3;
k=7;
f=figure(i,j,k);
x = 0:pi/100:2*pi;
y = j*sin(k*x-i);
h=plot(x,y);
legend(h,sprintf('%d*sin(%d*x-%d)',j,k,i),1);
title(['GRAPH_%d_INDJ_%d_INDK_%d',num2str(i,j,k)]);
print(f,'-dtiff', ['GRAPH_%d_INDJ_%d_INDK_%d',num2str(i,j,k)])
I expected to obtain:
graph title: GRAPH_5_INDJ_3_INDK_7; and
image name: GRAPH_5_INDJ_3_INDK_7,
where indices(IND)5 3 and 7 are part of titles and names.
But unfortunately I obtain the following error:
??? Error using ==> figure
Too many input arguments.
f=figure(i,j,k);
So I wonder if someone could help me to correct these line so that I obtain what I expect.
Thank you in advance for your help
Emerson

Best Answer

The last line should be:
print(f,'-dtiff', sprintf('GRAPH_%d_INDJ_%d_INDK_%d',i,j,k))