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!