필터 지우기
필터 지우기

how to store data based on range?

조회 수: 1 (최근 30일)
sivalogan satchithanandamoorthy
sivalogan satchithanandamoorthy 2017년 6월 26일
댓글: Jan 2017년 6월 27일
I have 25by1000 matrix in excel file. i want plot cyclic stress strain graph based on time range . example, I want to check using loop between time 10 to 100 and plot stress and strain in those range. time does not have regular increment parent. time value in sec (ex) 2.146 2.1505 2.1545 2.159 2.163 2.167 2.1715 2.1755 2.1795 2.184 2.188 2.192 2.1965 2.2005 2.2045 2.209. Any help would be much appreciated.
siva
  댓글 수: 1
Jan
Jan 2017년 6월 26일
The question is not clear. Did you import the data to Matlab already, or is this a part of the problem?

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

채택된 답변

Jan
Jan 2017년 6월 26일
편집: Jan 2017년 6월 26일
Assuming that the time is stored in the 1st column and the value in the 2nd:
Index = Num(:, 1) > 10 & Num(:, 1) < 100;
Time = Num(Index, 1);
Value = Num(Index, 2);
But I'm not sure if this solves your problem.
  댓글 수: 2
sivalogan satchithanandamoorthy
sivalogan satchithanandamoorthy 2017년 6월 27일
I could use the comment to solve the problem, but could you explain your code to me? when i used your code, what happening is between the range 10 to 100, if the values fall between them then it assign 1, if not 0. explanation would be wonderful. thank you
Jan
Jan 2017년 6월 27일
  • Num(:, 1) > 10 is a logical index vector, which is TRUE if the corresüponding value of Num is greater than 10.
  • Num(:, 1) < 100 the same, with TRUR if Num is greater smaller than 100.
  • The & combines the logical vectors. Now it is TRUE, if both conditions are TRUE.
  • Num(Index, 1) is the subvector of Num(:,1), which contains only the elements, which are inside the searched range.
  • Same foe Value.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Stress and Strain에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by