MATLAB Answers


check the condition and assign discrete values

Asked by subha
on 4 Nov 2013
Latest activity Answered by Image Analyst
on 4 Nov 2013

i have converted one dataset into four groups.say my datavalues are in between 0 to 1.

Then i seperated those values as <0.25 ,<0.5 ,<0.75,<1

now i want to assign 0.25 group as value 0, 0.5 group as 1 0.75 group as 2 1 group as 3

can anybody help in this?



No products are associated with this question.

2 Answers

Answer by Azzi Abdelmalek
on 4 Nov 2013
Edited by Azzi Abdelmalek
on 4 Nov 2013
 Accepted answer
[idx,idx]=histc(x,[0.25 0.5 0.75 1])
for k=1:4

  1 Comment

on 4 Nov 2013

I used quartile method.Also i found probability for each quartile.Now i want to replace each quartile state to 0,1 ,2 ,3 respectively.I didnt use any cell array type

can you give me idea in this case


Answer by Image Analyst
on 4 Nov 2013

If you have the Image Processing Toolbox, you could use imquantize().


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!