MATLAB: Index exceed number of elements when using data from an excel table

importing excel datanewbie

Hi guys, i'm doing an assignment on using data from an excel table in Matlab. Our task was to input the given data in form of a table. But when i ran the code, this error pops up and i don't really know where it went wrong or how to fix it. Please help!!
Error – Index exceeds the number of array elements (1).
Error in zadanie25 (line 12)
fprintf(' %12s ',t{i})
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:7000
fprintf(' %12s ',t{i})
fprintf(' %15s \n ',p{i})
fprintf(' %3.1i ',k(i))
fprintf(' %16i ',n(i))
end

Best Answer

  • for i=1:length(t)
    fprintf(' %12s ',t{i})
    end
    for i=1:length(p)
    fprintf(' %15s \n ',p{i})
    end