Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Convert ASCII-characters to double in simulink

1,170 views
Skip to first unread message

Erik

unread,
Apr 15, 2010, 8:41:06 AM4/15/10
to
I'm receiving serial inputs to a simulink model in the format ASCII-characters (in dec). For example, I'm receiving 49 46 53 which corresponds to the number 1.5.
Which is the easiiest way to convert 49 46 53 to a 1.5 (double) to be used in the Simulink model?

The Matlab-command native2unicode performs the conversion but I can't use this command in an Embedded Matlab function and build my model to a platform (in my case a dSpace microautobox). Is there a simulink model block which performs this operation?

Thank you,
Erik

Erik

unread,
Apr 16, 2010, 1:50:06 AM4/16/10
to
Anyone got a hint about this one?


"Erik " <erik.j...@consultant.volvo.com> wrote in message <hq71h2$kua$1...@fred.mathworks.com>...

minal BHADANE

unread,
Feb 21, 2011, 8:24:04 PM2/21/11
to
Hi Erik,
I am facing same problem. Did you solve this problem?
"Erik" wrote in message <hq8tqe$99$1...@fred.mathworks.com>...

Piyush Patil

unread,
Apr 5, 2011, 5:33:05 AM4/5/11
to
Hi Erik & Minal,
i am having the same issues with the Uni conversion. i am using dSPACE as like you. Did you guys find any solution to the problem. If yes Please do let me know about it.

Piyush

"minal BHADANE" wrote in message <ijv37k$sf0$1...@fred.mathworks.com>...

Torpedo3000

unread,
May 20, 2011, 4:49:04 AM5/20/11
to
Hi Erik & Minal & Piyush,

I have the some problem like you....

Piyush Patil

unread,
May 20, 2011, 6:26:04 AM5/20/11
to
hey guys,
i found a small solution to my problem.
all though its not 100% complete but to some extent....it works
making use of data type conversion & Embedded matlab function.

i still dont have the correct 100% solution, but this is atleast 70% working..

Regards,
Piyush

Joaquim

unread,
Aug 20, 2011, 2:44:08 PM8/20/11
to
Hi, everyone

I had this problem and solved using a block from xPC Target Toolbox.

Under xPC Target Toolbox, go to RS232 and look for the block "ASCII Decode".

It will convert you uint8 vector to double according to a format string like: %d\t%d\n (for example, if you have a uint8 vector that represents two integers separated by 'tab').

I hope this helps.

Joaquim

unread,
Aug 20, 2011, 2:45:09 PM8/20/11
to

Joaquim

unread,
Aug 20, 2011, 2:49:08 PM8/20/11
to
"Piyush Patil" <piyush...@live.in> wrote in message <ir5fjs$626$1...@newscl01ah.mathworks.com>...

I had this problem and solved using the simulink block "ASCII Decode", from xPC Target Toolbox.

This will convert your uint8 vector to double according to a format string like: %d\t%d\n (for example)

I hope it helps.

Madhu soodhanan GOVINDARAJAN

unread,
Nov 7, 2011, 8:47:10 PM11/7/11
to
Hey Piyush,

I am having the exact same issue as you had (reading encoder data in dSPACE) and it would be really helpful if you can share your 70 % working solution for this.

Thanks a lot for any help.

With Regards,
Madhu
"Piyush Patil" <piyush...@live.in> wrote in message <ir5fjs$626$1...@newscl01ah.mathworks.com>...

Robert MCNAULL

unread,
Oct 16, 2012, 6:32:18 PM10/16/12
to
Any chance you could share you solution to the parsing, trying to do a similar thing by bring in GPS NMEA strings and need to parse them on an MABII.

"Piyush Patil" <piyush...@live.in> wrote in message <ir5fjs$626$1...@newscl01ah.mathworks.com>...
0 new messages