wirte in excel sheet.
이전 댓글 표시
I need to write some arrays in specified rows.I use xlswrite('Book1.xlsx',q,'A11:BI2').But I get the same answer in each rows.The second row is also same as the first.But I need each rows are different.How can I get different values.
댓글 수: 5
Shubham Gupta
2019년 10월 10일
May I know the size of 'q' variable ?
John Doe
2019년 10월 10일
Can you please show q
Silpa K
2019년 10월 10일
Shubham Gupta
2019년 10월 10일
Do this, after running your current code type:
whos q
in command window and let us know what is the output.
Silpa K
2019년 10월 10일
답변 (2개)
prasanth s
2019년 10월 10일
Delete the already created excel sheet.
Change the last line of code to
xlswrite('Book1.xlsx',q,'A1:BI1')
if you want to store in the second row, then change the 'A1:BI1' to 'A2:BI2' .
Shubham Gupta
2019년 10월 10일
So, in order to change row as you change the q, you have to change the range dynamically.
row_num = 1; % you can change that using a for loop
Range = ['A',num2str(row_num)];
xlswrite('Book1.xlsx',q,Range)
But it will only affect the performance of your code. So, what I suggest is that you store all the q array in a "master" array dynamically
i = 1; % you can change that using a for loop
master_data(i,:) = q;
and save that master array in the Excel file at the end of the code using :
xlswrite('Book1.xlsx',master_data,'A1')
카테고리
도움말 센터 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!