Two variables concatenation to one in Simulink

2 views (last 30 days)
Hello, I am trying to concatenate this 2 values A and B and send the resolution to C
Like if i have A=1111 and B=9999 i would like to have C=11119999,
is there a block that can do this, of a function i can use ?
Thanks in advance.

Answers (1)

Walter Roberson
Walter Roberson on 8 Aug 2022
How do you want distinguish these cases:
A = 1234 B = 567
A = 123 B = 4567
What do you want to do if the values are negative? If A is positive and B is negative do you want (for example 1111-9999 as the result?
  1 Comment
MOUTAMANI NADIA on 11 Aug 2022
Thanks a lot for your response A & B are both positive numbers that don't exceed 9999
What i ended up doing is C=(A*10000)+B to have one value, that assures me that i will have A in the first 4 digits and B in the lasts.
With this i got what i wanted, but if there is a better method i am willing to try it, and thanks again.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!