Creating a variable that denotes a range of values
古いコメントを表示
I have a dataset that looks like this:
Signal PT#1 PT#2 ... PT#26
0.20 2121 1232
0.21 1233 1233
0.22 1236 1232
0.23 1232 1236
...
1.00 1212 1232
...
4.00 1212 12321
I used this code to discretize the values to the hundredth's and average it for each group of values.
edges = (0:0.05:4);
allData(:,27) = discretize(allData(:,1),edges);
[C,~,IC] = unique(allData(:,27));
avg=NaN(76,26);
for i = 1:25
avg(:,i) = accumarray(IC, allData(:, i+1), [], @mean); % calculate the mean in your data of column 2 for rows in IC with identical elements
end
Result = [C avg];
This resulted in a dataset "Result" that looks like this
1 1241 1231 1232
2 1232 1232 1231
...
76 2312 1231 1231
How do I convert the first column into ranges of the variables that were discretized? Like I want the first row to say "0.2 to 0.25" rather than "1" ?
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Descriptive Statistics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!