How i can write array cell to excel sheet using loops?
3 次查看(过去 30 天)
显示 更早的评论
I am trying to write cell array contents from matlab to excel sheet , the cell array is (1x4) cell .
The first cell({1,1}) contains a string (glcm11) ,and the second cell({1,2}) contains (glcm12) ,the third cell({1,3}) contain (glcm13) , and the fourth cell is (glcm14) .
How i can write these cells to excel sheet using loops to range (a2:a5)?
0 个评论
回答(2 个)
Raj
2019-6-3
What is the issue? Is this what you are looking for:
a{1,1}='glcm11';
a{1,2}='glcm12';
a{1,3}='glcm13';
a{1,4}='glcm14';
xlswrite('test.xls',a,'A2:A5')
"How i can write these cells to excel sheet using loops to range (a2:a5)" - What is the need to use loops?
0 个评论
Murugan C
2019-6-3
Hi ahamd,
use below script.
% with for loop
input_data = {'glcm11','glcm12','glcm13','glcm14'};
for i = 1 : length(input_data)
write_data = input_data(i);
range = strcat('A',num2str(i+1));
xlswrite('new.xlsx',write_data,'sheet1',range);
end
% OR without for loop
input_data = {'glcm11','glcm12','glcm13','glcm14'}';
xlswrite('new.xlsx',input_data,'sheet1','A2');
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!