using fprintf to print selected rows from an excel file?
显示 更早的评论
i'm trying to use fprintf to print all three columns of an excel file, but only the first five rows. how do i go about this? thank you.
2 个评论
Walter Roberson
2016-9-6
Insufficient information about the data types of the columns. Does "first five rows" include one or more header lines? Are any of the columns dates?
Anjum Syed
2016-9-6
回答(1 个)
Keith Hooks
2016-9-6
You could do something like this:
[len, width] = size(q);
for row = 1:len
fprintf('%d %s %s\n', q{row,1}, q{row,2}, q{row,3})
end
I made some assumptions about your data types. You might want to customize the %d, %s placeholders to your needs.
类别
在 帮助中心 和 File Exchange 中查找有关 Data Import from MATLAB 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!