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

Point me in the right direction please

已解决!
转到解答

Hello,

 

I am querying a device for its settings. The device will return a code. What I would like to do is from the returned code assign to this code a piece of text (ie. "the instrument is on" for 1 or "the instrument is sleeping" for 2).

 

How do I do this?

 

Thanks,,

 

Nevica

0 项奖励
1 条消息(共 7 条)
3,046 次查看

It seems to me you are describing an Enumerated type. Use the enumerated type as an indicator and pass the code to the input. But that really doesn't give you a "text" string. Do you really want the result to be a string? That can be done using a case structure, or creating yourself an array of strings that matches the code and then using the returned code to select the index of you array.

0 项奖励
2 条消息(共 7 条)
3,039 次查看

How do I index an array. I think this is what I want!!!

 

Nevica

0 项奖励
3 条消息(共 7 条)
3,035 次查看

The simplest way...

 

Chart.PNG

0 项奖励
4 条消息(共 7 条)
3,027 次查看

Thanks, thats how I imagined it would work. But how do I create the 1 by 3 indexed string matrix (the purple box). I cannot find this anywhere. I am searching for indexed string and I cannot find in example finder!!!

 

 

Thanks,

 

Nevica 

0 项奖励
5 条消息(共 7 条)
3,024 次查看

Place an array constant and a string constant on the block diagram.

 

Now drag the string constant into the array constant with your mouse. It should turn from black to pink.

 

Now you have created an "Array of string" constant.

 

 

0 项奖励
6 条消息(共 7 条)
3,021 次查看
解答
已被主题作者 nevica 接受

Aha, that's how its done. thanks.

0 项奖励
7 条消息(共 7 条)
3,018 次查看