Hi there,
Hereby attached(.xml file) which is having two different parameter results (x and y).
I need to take those results into scatter table defining different ranges as mentioned in the Table 01.
How can I do that programmatically?
Your help is much appreciated.
BR,
Ravi

 채택된 답변

Guillaume
Guillaume 2018년 12월 20일

1 개 추천

There's no x value smaller than 0.5 in your inputs so it's unclear why you have a 10 in your first row of your table. I'm going to assume that your table is incorrect. There are more inconsistencies.
Your bin edges are also badly defined. What happens if x is 0.55, it's outside any of your bins. Same for y = 10.5. Normally you would define the end of bin 1 as x<0.5 and the start of bin2 as x>=0.5 (or x<=0.5 and x>0.5).
So, ignoring all these inconsistencies, use histcouns2 to compute the histogram:
xy = xlsread('Scatter table.xlsx', '3:4');
histcounts2(x(1, :), y(2, :), [0 0.5 1.0 1.5 Inf], [0 5 10 15 Inf], 'Normalization', 'probability') * 100

댓글 수: 4

Sorry about the inconsistencies. Actual table having more values than the attachement and yes, I made the mistake here.
Anyway, Thank you very much for your answer, unfortunately I'm using Matlab 2015a which doesn't have histcouns2 function.
Is there any possible to do that without using 'histcounts2'?
Your help is much appreciated.
Thank you
I have modified the table. sorry about the inconvienience caused.
Here is a cheap replacement of histcounts2 with the 'probability' normalisation:
xy = xlsread('Scatter table.xlsx', '3:4'); %or however you want to import the data
xbin = discretize(xy(1, :), [0, 0.5, 1, 1.5, Inf]); %or whichever bins you want for x
ybin = discretize(xy(2, :), [0, 5, 10, 15, Inf]); %or whichever bins you want for y
accumarray([xbin(:), ybin(:)], 1) / numel(xbin) * 100
Thank you very much. This works perfectly. :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

질문:

2018년 12월 20일

댓글:

2018년 12월 20일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by