I have the following array:
A=[1; 2; 3; 4];
I then make an array B:
B=[]
I then use a for loop to assign each number in array A a color.
for j=1:length(A) if A(:,i)=1 B=('blue'); elseif A(:,i)=2 B=('yellow); elseif A(:,i)=3 B=('green'); else A(:,i)=4; B=('black'); end end
The B array has all of the colors.
I want to use fprintf to to have A and B as the headings of the table, where column A has [1; 2; 3; 4] and column B has all of the colors next to their corresponding number from the for loop.
How can I do this?
Best Answer