how to divide excel files in matlab into uneven groups
Mostrar comentarios más antiguos
i have excel file with 3000 row and 1 column. once i import it using xlsread (data),i want to calculate the average values based on the range in i, i= 1,120,500, 1500, 2300,3000. That means the first average value contains the data from row 3 to row 120 and the second from 121 to 500 and so on. so at last the average values can be a column vecor with 5 rows .Could you please help. Thanks
Respuesta aceptada
Más respuestas (1)
Star Strider
el 7 de Jul. de 2015
You can do it without loops, using cell arrays:
V = randi(99, 3000, 1); % Create Data
Partitions = diff([0 120 500 1500 2300 3000]); % Define Vector Partitions
C = mat2cell(V, Partitions, 1); % Create Cell Arrays
Result = cellfun(@mean, C); % Take Means
The ‘Result’ assignment is the output, containing the means of the partitioned vector.
Categorías
Más información sobre Data Import from MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!