Using part of data as variables
3 views (last 30 days)
Show older comments
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?
1 Comment
Accepted Answer
Azzi Abdelmalek
on 6 Jan 2016
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 Comments
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!