Calculate average of some specific cell of excel file and print in another excel file
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, I have a big excel file with 6 column and 3000 row. For row 4, i have to calculate the average of each five cells like D1:D5, D6:D10 and so on and print it in another excel sheet. Can anyone help me to do that? I can read the file in MATLAB. Thank you.
0 commentaires
Réponses (4)
Image Analyst
le 12 Août 2016
6 by 3000 is not big - far, far from it.
Try this:
% Read in the data
data = xlsread(inputFilename);
% Extract column D
colD = data(:, 4);
% Reshape to give 5 columns
colD2 = reshape(colD, [], 5);
% Get means going across the columns
theMeans = mean(colD2, 2);
% Write out to a new workbook
xlswrite(outputFilename, theMeans, 'Means', 'A1');
0 commentaires
my8950
le 22 Jan 2019
I am searching through trying to find some examples to begin working from. I have 0 experience, but the question asked here is similar to what I am after.
Many excel files, I can put them all in one folder location. I want to grab a group of cells in a certain column and average them, then write them to another excel file only containing the results of the average. (O6600:O9293)
There are many columns and cells that I want to do this with, but I think if I can get the first one mentioned above to work, then I can build onto that.
This is a very basic question I think, but when I sitting here looking at a blank screen with no knowledge, its a bit more challenging. I'm open to examples and other suggestions on how to learn as well.
Thank you!
0 commentaires
Lei Shen
le 1 Juil 2019
- load the excel using function: readtable
- extract specific column:
- convert table to arry: table2array
- reshape the column
- calculate the mean of each column using: mean
0 commentaires
pranati pradhan
le 17 Nov 2019
I have same problem,but the specific column for which i want to calculate the average contains some non numeric values(which is showing as NaN(Not a number).I implemented the above code but the average is showing as NaN.Please help me with this.
1 commentaire
Voir également
Catégories
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!