Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Add a value to an already fulfilled cell in an excel file
2 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I would like to know how I can add a given value (+50) to a cell which already contains an initial value in several excel files at once (same value in same cell for all excel files) using a loop.
Thank you in advance.
0 件のコメント
回答 (1 件)
Arvind Narayanan
2017 年 10 月 26 日
Hi,
You can store the names of all the Excel files in a cell array and use the xlswrite command in a for loop that iterates through the contents of the cell array and writes into each Excel file. A sample of the code snippet would be as follows:
if true
files = {'blank1.xlsx','blank2.xlsx','blank3.xlsx','blank4.xlsx'}; %names of the Excel files
s=size(files);
for i=1:1:s(2)
filename=files{i};
xlswrite(filename,200,'Sheet1','B4'); %Writing into cell B4
end
end
In the above snippet, I am iterating through the cell array that contains the filenames. In each iteration, I use the xlswrite function to write into the B4 cell of the Excel sheet. Please refer to the documentation of xlswrite command to understand the Name-Value pairs of arguments.
Hope this helps.
0 件のコメント
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!