finding the computation for n columns
显示 更早的评论
Hi
Given a a vector table z with column and row of 1200 and 1200 respectively
I want to compute the following for each rows
z = ( T R S T V............n column)
first column T
K = 3;
c1 = sort(T.distance(1:2:end));
c2 = sort(T.distance(2:2:end));
s1 = sum(c1(1:K))/sum(c2(1:K )) ;
second column R
K = 3;
c1 = sort(R.distance(1:2:end));
c2 = sort(R.distance(2:2:end));
s2 = sum(c1(1:K))/sum(c2(1:K )) ;
disp(s2);
How do I make this computation using a small code for n columns
Thank you in advance
Tino
回答(1 个)
madhan ravi
2019-5-14
编辑:madhan ravi
2019-5-14
Z=z{:,:};
K = 3;
c1 = sort(Z(1:2:end,:));
c2 = sort(Z(2:2:end,:));
s1 = sum(c1(1:K,:))./sum(c2(1:K,:))
11 个评论
madhan ravi
2019-5-14
Thanks Madhan
But I am getting this error when I try to compute
J = Z{:,:};
K = 3;
c1 = sort(J(1:2:end,:));
c2 = sort(J(2:2:end,:));
s1 = sum(c1(1:K,:))/sum(c2(1:K,: )) ;
disp(s1);
Error
Brace indexing is not supported for variables of this type.
Error in martingale (line 35)
J = Z{:,:};
Thanks in advance
madhan ravi
2019-5-14
not Z it's z
Tino
2019-5-14
madhan ravi
2019-5-14
Attach your table as .mat file.
madhan ravi
2019-5-14
HI Madhan
I have attached the table below consisting of 1200 rows and 1200 column
the code is to computation for each column
and I am suppose to get 1200 answers
thanks in advance
madhan ravi
2019-5-14
I'm not able to open your file (try once again) , please don't add an answer just to make a comment
Tino
2019-5-14
madhan ravi
2019-5-14
Having trouble opening your file.
Tino
2019-5-14
Tino
2019-5-15
madhan ravi
2019-5-15
编辑:madhan ravi
2019-5-15
No , I am not able to , there‘s some problem downloading files in my mac.
类别
在 帮助中心 和 File Exchange 中查找有关 Communications Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!