Hi, I'm trying to analyze some data exported from another program. This data file has 4 columns and a couple of hundred rows. I'm interested in the data from the 1st and the 4th column, but only for parts of it. The parts in which I am interested can be deduced from the 3th column. Example:
x y z T
0 1 0 12
1 1 0 13
4 1 0 10
5 1 0 14
6 1 .1 17
2 1 .1 11
7 1 .1 12
8 1 .5 14
So to clarify... I want to create a variable x (for z0, z0.1, z0.5 etc.) and a T variable for the same z's...
I just started with using 'if' functions and thought I could maybe use it for this. However, I don't know how. I know the next example isn't correct, but maybe it clarifies what I've got in mind...
if data(,3) == 0
save corresponding rows of column 1 to x_z00 & T_z00
end
Does anyone have an idea how I could solve this problem?

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 1월 6일

0 개 추천

v=[ 0 1 0 12
1 1 0 13
4 1 0 10
5 1 0 14
6 1 .1 17
2 1 .1 11
7 1 .1 12
8 1 .5 14 ]
idx=v(:,3)==0
out=v(idx,[1 4])

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2016년 1월 6일

편집:

2019년 6월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by