Calculate average of some specific cell of excel file and print in another excel file
30 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (4)
Image Analyst
el 12 de Ag. de 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 comentarios
my8950
el 22 de En. de 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 comentarios
Lei Shen
el 1 de Jul. de 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 comentarios
pranati pradhan
el 17 de Nov. de 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 comentario
Ver también
Categorías
Más información sobre Spreadsheets en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!