取消
显示结果 
搜索替代 
您的意思是: 

Scan From String - Data Within Double Quote

已解决!
转到解答

Hi Folks,

 

Can you help me on getting the string out from (Send message “15 E 1 0 0 80 80 80 80 0 0 0 0 FF 0” to sim module)....?

 

I want to extract 15 E 1 0 0 80 80 80 80 0 0 0 0 FF 0 using Scan From String function. By the way, let me know, if there is any efficient method than using Scan From String function.

 

Thanks

 

0 项奖励
1 条消息(共 11 条)
10,354 次查看
解答
接受人 Blessing_Star

Do you simply want to remove the double quotes or are you looking to extract the numbers? If you simply want to remove the double quotes here is a VI that will do that.

 



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
2 条消息(共 11 条)
10,346 次查看

Thanks for helping me. I want to extract the Hex values those are inside the quote.

 

Input String = Send message “15 E 1 0 0 80 80 80 80 0 0 0 0 FF 0” to sim module

Expecting O/p = 15 E 1 0 0 80 80 80 80 0 0 0 0 FF 0

 

Appreciate your help. 🙂

 

Thanks

0 项奖励
3 条消息(共 11 条)
10,338 次查看

Perhaps the code I posted here would be useful.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
4 条消息(共 11 条)
10,334 次查看

You can use Scan from string with the following format specifier:

 

extract hex data.png

 

the number of %x must match the number of hex values in the input string. If the value is not constant consider using a regular expression to extract the data. %[^"] will match any string characters up to the first double quote. The double quote in the format specifier must be the same as the one in the input string (I changed it in the example code).

 

Ben64

5 条消息(共 11 条)
10,322 次查看

@ben64 wrote:

You can use Scan from string with the following format specifier:

 

extract hex data.png

 

the number of %x must match the number of hex values in the input string. If the value is not constant consider using a regular expression to extract the data. %[^"] will match any string characters up to the first double quote. The double quote in the format specifier must be the same as the one in the input string (I changed it in the example code).

 

Ben64


The one downside of this approach is that your input string must always a particular size. If your data can vary in the number of hex numbers you will get a more generallized solution using a loop will be required. This is essentially what the link that I posted earlier does.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 项奖励
6 条消息(共 11 条)
10,316 次查看

Thanks for the help. If you look at closely, input string have quotes like this 13 E 1 8 0 80 FE 80 80 0 0 0 0 FF 0. Those quotes are quite different from this one ". I think, i may have to use these quotes as per the input string.

 

Thanks for all the responses.

0 项奖励
7 条消息(共 11 条)
10,314 次查看

Yes, the quotes you have are different but the various solutions posted will work as long as you include the correct character(s) in the regular expression or scan from string format specifier.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 项奖励
8 条消息(共 11 条)
10,302 次查看

Thanks to Mark & Ben for the responses.

0 项奖励
9 条消息(共 11 条)
10,295 次查看

I was checking 'Unquote String (DQ).vi'. It has some limitations.

Look at the results:

imagen.png

Thanks.

0 项奖励
10 条消息(共 11 条)
4,578 次查看