How to merge digits from a step signal into a single number(Simulink)?
3 次查看(过去 30 天)
显示 更早的评论
Hi, i have the following simulink model, i want to send values to my PIC microcontroller, do some calculations in mikroPascal and send it back to Simulink.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/151267/image.gif)
I receive the digits of the number (1 digit= 1 byte) one after another, it looks like a step signal in the scope. Example:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/151269/image.gif)
The question is, how can i do this algorithm:
number=number*10+digit;
{i want to concatenate the digits, so number = 123456789}
with Simulink blocks? The biggest problem is that i can't tell simulink to take a sample every 0.01s(that's the period between the digits of the output number) and use the value as the digit parameter in a function which does the same as the equation above. Any ideas? Thanks, and sorry for the big pics
采纳的回答
ChristianW
2013-2-26
"User-Defined Functions" is an option.
As another possibility (among many) you can take "Triggered Subsystems", with the trigger >is digit changed< (implemented eg. with memory and logical ~= block).
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sources 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!