<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>

新聞中心

EEPW首頁(yè) > 測試測量 > 設計應用 > LabVIEW中將字符串轉換成ASCII碼

LabVIEW中將字符串轉換成ASCII碼

作者: 時(shí)間:2017-01-05 來(lái)源:網(wǎng)絡(luò ) 收藏
因為任何數據采集后都希望能做出圖表來(lái),在LabVIEW里寫(xiě)了一個(gè)串口的程序,無(wú)奈輸出的是字符串,而作圖的輸入數據必須要是數值類(lèi)型,找遍了控件也沒(méi)看見(jiàn)將字符串轉換成相應ASCII碼的控件。于是上網(wǎng)搜索,真是眾說(shuō)紛紜,很多人說(shuō)用十六進(jìn)制數字符串轉換成數值的控件,也有人說(shuō)用掃描字符串的控件,本人也是初學(xué),發(fā)現這兩種方法并不能實(shí)現我的目標。

雖然我的字符串輸入控件選擇的是顯示16進(jìn)制數,但數據流實(shí)際上記錄的是該字符串的ASCII碼。所謂將十六進(jìn)制數字符串轉換為數值,其實(shí)是指正常顯示時(shí)顯示為16進(jìn)制數。舉個(gè)例子,ASCII碼的0x31,對應于字符“1”,如果輸入0x31即“1”,則用上述控件就會(huì )將該字符串轉換為0x01。

本文引用地址:http://dyxdggzs.com/article/201701/336582.htm

而第二個(gè)說(shuō)法提到的掃描字符串,其實(shí)是將字符串中的數字提取出來(lái),而并不是得到該字符串的ASCII碼。比如,ab123c,用一定的格式說(shuō)明就可以把123提取出來(lái),即輸入“ab123c”,可以得到數字123。這種方法也可以提取浮點(diǎn)數,具體可以參見(jiàn)LabVIEW的幫助文檔。

將字符串轉換成相應的ASCII碼,我用了挺復雜的方法,如果有幸被高手看到此文章希望能抽出寶貴的時(shí)間留下更好的方法。因為我是要做圖,于是每次循環(huán)的時(shí)候我只要字符串的最后一個(gè)字符的ASCII碼,所以我先將該字符分離出來(lái),然后將它轉換成字節數組,再提取數組元素,就得到了該字符對應的那個(gè)ASCII碼。具體如下:

第一個(gè)小方框是“字符串”->“字符串長(cháng)度”

第二個(gè)是“字符串”->“截取字符串”

第三個(gè)小框里有U8的是“字符串”->“字符串/數組/路徑轉換”->“字符串字節數組轉換”

第四個(gè)是“數組”->“索引數組”



關(guān)鍵詞: LabVIEW字符串ASCII

評論


技術(shù)專(zhuān)區

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>