MATLAB: Display Data into columns

fprintfimporting excel data

Hi, i'm trying to get the data in k and n (the codes in the last 6 lines) to display as columns using the following code. But when i ran it, it all merged into one row. Any help would be great!
K and N is data imported from an external excel file
clc
Name_F='Таблица Турбобуры.xlsx';
Name_L1='Лист1';
[n,t]=xlsread(Name_F,Name_L1,'g1:g17')
[n,p]=xlsread(Name_F,Name_L1,'j1:j17')
k=xlsread(Name_F,Name_L1,'g1:g17')
for i=1:length(t )
fprintf(' %12s ',t{i })
end
for i=1:length(p )
fprintf(' %15s \n ',p{i })
end
for i=1:length(k )
fprintf(' %2i',[;k(i)])
end
for i=1:length(n )
fprintf('%5i',[;n(i)])
end

Best Answer

Specify newline using \n
for i=1:length(k )
fprintf(' %2i\n', k(i))
end
for i=1:length(n )
fprintf('%5i\n',n(i))
end
Related Question