필터 지우기
필터 지우기

How to start analysing data from the highest value from excel?

조회 수: 1 (최근 30일)
Alexander
Alexander 2014년 12월 6일
댓글: Jos 2014년 12월 7일
Hello,
I have an excel file with all my data from different files, and I would just like to make it so that the data points I use for calculations start from the highest value of the data points.
experimentData = xlsread('Healthy_original.xlsx'); %Change for each experiment
t=experimentData(1:500,1);
for i=1:10 %start of loop
a=experimentData(1:500,1+i);
%%loop continues
Is there a way to get it so that the highest value of the data is taken to be the first point, everything before the highest point is irrelevant.
Thanks for any help

채택된 답변

Jos
Jos 2014년 12월 6일
Hi Alexander,
I'm not entirely sure this is what you're looking for but I assume you want the vector 'a' within your for loop to start from the highest value in that particular column. To do this you can find the indices of the highest values in each column before the for loop
[~, indices] = max(experimentData(1:500,:));
then within the for loop you can use your data from the highest value by
a = experimentData(indices(i):500,1+i);
Cheers
Joe
  댓글 수: 2
Alexander
Alexander 2014년 12월 7일
편집: Alexander 2014년 12월 7일
Thanks very much for your answer, did a bit of tweaking and managed to get the results I was looking for. But I was wondering if you could just explain what kind of function [~, indices] is.
I understand that its creating a vector, but what does the ~ sign mean?
Thanks!
Jos
Jos 2014년 12월 7일
the function max() creates two vectors if you use it on a matrix, a vector containing the maximum values and a vector containing the associated indices of these values. You can get both vectors by using
[max_values, indices] = max(experimentData(1:500,:));
In the case above I was only interested in the indices of the maximum values, therefore I used ~ instead of max_values which basically means the first output vector will not be generated

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by