Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Comparison of entries of one data set (just one column) with multiple columns of second data set
1 回表示 (過去 30 日間)
古いコメントを表示
Hi everyone,
May someone help me here...
The picture below represent what I want to get. I think this needs 2 to 3 for loops and one if comand only ...
[Let me explain for more clerity:
May someone help me to perform the same calculation for all columns of first data set with the values of seocnd data se. 'a' reprsent the data set consists of 28 columns with diffrent data points; 'b' repsrent the data set of 76 enteries;
Initially, we pick first entry of 'b' suppose called as 'c' then we search in the first columns of 'a' with a condition that column consists of data points values greater than and less then the first vale of 'b'. If this condition not meet, then we look into the second column of 'a', third column and sop one...
When the condition meet... then we split the column into two parts: (1) consits of values greater than the first value of 'b' say 'e'; (2) consists of values less than the first value of b say 'f'. After that, we pick minimum value of 'e' say 'g' and maxium value of 'f' say 'h'. At the last step, I calcualte i=g-c and j=c-h,
later, I get my answer by this relation = i/(i+j)]
0 件のコメント
回答 (1 件)
KSSV
2020 年 9 月 12 日
To check whether all the values are less than or greather than a certain value/array. You can get the logical indices and use nnz. If nnz is equal to the length then the condition is met.
% Let a be any array and val be the value to check
a = rand(10,1) ;
val = 1 ;
n = length(a) ;
idx = a < val ;
if nnz(idx) == n
fprintf("all the elements in a are less than val\n")
end
11 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!