may i ask how to separate a value into two different values? For example, 12 can be separate into 8 and 4..

2 views (last 30 days)
may i ask how to separate a value into two different values? For example, 12 can be separate into 8 and 4..
  2 Comments
loong seow li
loong seow li on 23 Apr 2016
that is just the example that what I want... because I need to split the value into two random numbers... may be 12 can be split into 6 and 6 or 7 or 5...

Sign in to comment.

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 22 Apr 2016
Edited: Azzi Abdelmalek on 22 Apr 2016
If you mean how to do it randomly with integer numbers:
N=12
a=randi(N)
b=N-a

More Answers (0)

Community Treasure Hunt

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

Start Hunting!