MATLAB Answers


Rational Numbers diving by 0

Asked by Hello kity on 4 Jan 2013


I show the result of each data ontop of a bar. I have it working. On top of each bar it shows of the rational of failure/measurements.


if Fail is 0, then the answer is 0. this is what is shown on top of the bar. but I want that it shows 0/X-amountofmeasurements.

how to?



No products are associated with this question.

1 Answer

Answer by the cyclist
on 4 Jan 2013
Edited by the cyclist
on 4 Jan 2013
 Accepted answer

I think you will probably have to convert to a string manually, to display it how you'd like. For example:


You can of course put variable names where I have put hard-coded numbers. You can also use the sprintf() function to have more precise control over the output format.


I think i ll do that first one. there are only a couple bars so wont make the code that longer. \


I got rid of the rat function and made all of them with strings :)

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

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

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!