How write multiple data output in excel sheet using xlswrite command
古いコメントを表示
Hi All,
I want to know how can we write multiple data strings in the same excel sheet for a design simulation. As We know that whenever we specify xlswrite command it starts writing from cell A1 of the excel sheet.
Now, my problem is quite specific. I am carrying out a design calculation for a treatment works. At the end of the design calculation I am storing the variables in the excelsheet using xlswrite command. Now for a set of values of particular variable A , I want to do all the design calculations and then store them in excel sheet in different rows. How can we do it. I tried to run for loop but it always stores the data in the first row of the excelsheet so only the last set of data is available through xlswrite statement.
Program syntax is something like that
a=1 ;
b= equation1 c=equation2 d=equatio3
then finally I use xls write to write all these variables in an excelsheet.
Now for a range of values for variable a, I want to do the work and store them in the same excel sheet row wise. How can one do it . I would appreciate if someone comes up with a solution.
Regards
1 件のコメント
José-Luis
2012 年 11 月 13 日
I don't understand. Can't you just specify a range or a particular cell where you want to save you data?
採用された回答
その他の回答 (5 件)
Ilham Hardy
2012 年 11 月 13 日
doc xlswrite
Amit Christian
2012 年 11 月 13 日
0 投票
1 件のコメント
Have you actually read the documentation?
xlswrite(filename,A,sheet,range)
That does what you ask for. Or am I missing something? Also Mark gave a good answer to your question that avoids the overhead of repeated calls to xlswrite() that have the potential to slow down your code considerably.
mohammad tahmasebi
2013 年 2 月 25 日
0 投票
Hi Amit. i have I have a similar problem.If you find a answer Please tell me. Thank you very much
vijay
2013 年 6 月 17 日
Hi, this is what is needed
a=5 b=4 c=10 d= a*b; e= b*c; f= d*e;
offset =1;
for a_iter 1:5
a = a_iter; b= 4*a_iter;c = 10*a_iter; d= a*b; e= b*c; f= d*e;
xlswrite('filename.xls', [a b c d e], 1, sprintf('A%d',offset));
offset = offset + 1;
end
It will print in the A1 row for first time. and then go to next row by this sprintf('A%d',offset);
4 件のコメント
Saheed Adio
2014 年 2 月 4 日
Hi Vijay,
What if the answers to be written in the excel file are in column and not rows how do I write the code for the xlswrite().
Thanks
I am also interested in switching columns...tried ('%s2',offset) but starts further down in rows. Should I be using %s? How does it know to start at Column B? Do you know where I can find a list of special characters to manipulate cell references?
KRUNAL
2014 年 8 月 5 日
I have created a new post. I hope you can now answer me for it. The link for that questions is :
Looking forward for your reply and suggestions on it
Pratik Nikam
2020 年 8 月 19 日
I wish to run the program 3 times, and each time I want to save data in a same excel sheet but to the new row. Will it be possible to do?
Thanks.
Pratik N.
カテゴリ
ヘルプ センター および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!