I'm having trouble creating a chart using the fprintf command. I'm trying to create one by limiting myself to three fprintf commands. This is the code that I'm using:
x = [1:5];y = [1:3];[X,Y] = meshgrid(x,y);z = X.^2 + Y.^2;t = z';i = t(:,1);j = t(:,2);k = t(:,3);fprintf(' y = 1 2 3 \n');fprintf(repmat('-',1,35),'\n');fmt = ['x = %5.0f | \n', x'];fmt1 = ['%5.0f %5.0f %5.0f \n', [i,j,k]]fprintf(fmt, fmt1)
It is supposed to look something like this
I appreciate any help.
Thank you
Best Answer