Could anyone please help me to write the matlab code with bit explanation. Thanks in advance.
1 view (last 30 days)
Show older comments
Mohammad Sohel Rana
on 14 Feb 2017
Edited: Walter Roberson
on 14 Feb 2017
I have below data set. I want to take data set (L and W) when only N2 is integer. Other data of L and W will be deleted.
N1 =8.0000 10.0000 12.0000 14.0000 16.0000 18.0000 20.0000 22.0000 24.0000 26.0000 28.0000 30.0000
N2 =20.0000 16.0000 13.3333 11.4286 10.0000 8.8889 8.0000 7.2727 6.6667 6.1538 5.7143
L = 0.3200 0.4000 0.4800 0.5600 0.6400 0.7200 0.8000 0.8800 0.9600 1.0400 1.1200
W =0.8000 0.6400 0.5333 0.4571 0.4000 0.3556 0.3200 0.2909 0.2667 0.2462 0.2286
0 Comments
Accepted Answer
KSSV
on 14 Feb 2017
clc; clear all ;
N1 =[8.0000 10.0000 12.0000 14.0000 16.0000 18.0000 20.0000 22.0000 24.0000 26.0000 28.0000 30.0000] ;
N2 =[20.0000 16.0000 13.3333 11.4286 10.0000 8.8889 8.0000 7.2727 6.6667 6.1538 5.7143] ;
L = [0.3200 0.4000 0.4800 0.5600 0.6400 0.7200 0.8000 0.8800 0.9600 1.0400 1.1200] ;
W =[0.8000 0.6400 0.5333 0.4571 0.4000 0.3556 0.3200 0.2909 0.2667 0.2462 0.2286];
% get integers in N2
idx = find(mod(N2,1)==0);
% pick L and W when N2 is integer
L1 = L(idx) ;
W1 = W(idx) ;
More Answers (0)
See Also
Categories
Find more on Logical 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!