I want to take difference of column A (first column in sheet_1) and column B (also first column in sheet_2). Output should be file C in workspace.
1 回表示 (過去 30 日間)
古いコメントを表示
Muhammad Salman Sarfraz
2017 年 12 月 8 日
編集済み: Michal Dobai
2017 年 12 月 19 日
Hi, Following question can easily be solved in Excel, But i want to run Matlab code because i have hundreds of file and can't do excel merging or copy pasting columns in new sheets for whole life. Therefore, I want this in matlab. I want to take difference of column A (first column in sheet_1) and column B (also first column in sheet_2). Output should be file C in workspace. A B C 36 33 3 34 31 3 25 34 -9 19 31 -12
Thanks you!
2 件のコメント
Image Analyst
2017 年 12 月 18 日
Michal, do you want to put this down in the Answers section so he can accept it and give you credit (reputation points)?
採用された回答
Michal Dobai
2017 年 12 月 19 日
So you have excel file containing two sheets. And you want to:
- subtract numbers in column A in sheet_2 from numbers in column A in sheet_1
- save (just) these differences to excel file named 'C.xlsx'
Is that right? Then you can do this:
A = xlsread('myFile.xlsx', 'sheet_1');
B = xlsread('myFile.xlsx', 'sheet_2');
xlswrite('C.xlsx', A(:,1)-B(:,1) );
In this case input file is 'myFile.xlsx' and names of first and second sheet are sheet_1 and sheet_2. If you don't know exact names, but you know that it's always first and second sheet, you can replace names with their numbers.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!