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

How to save data in while loop to array

已解决!
转到解答

Hi everyone. I'm trying to output the results in the while loop via an AO port. But I could only output the first data in the loop. I don't know where I go wrong. 

Any feedback could be helpful.

Attached is my code.

Thanks.

 

0 项奖励
11 条消息(共 18 条)
2,806 次查看

Are you getting any error messages?

 

What kind of value is being written to the analog output?

 

I see you calculating a value for center of gravity and dividing it by 2.  Then writing that value to the analog output?  What is the result of that calculation?  If that value is outside the range of 10 to -10, then you will get an error because you are writing a value of CG into a function that expects a value in Volts, and a voltage that is in the range of what it can put out.

0 项奖励
12 条消息(共 18 条)
2,749 次查看

I didn't receive any error message.

 

The result is not divided. I add "sum" and "multiple & sum" just to check the calculating process. The "center of gravity" is what I need.

0 项奖励
13 条消息(共 18 条)
2,729 次查看

I divided it by 2 just to made it smaller. That's not necessary.

0 项奖励
14 条消息(共 18 条)
2,722 次查看

I cleaned up your VI to get rid of your backwards running wires.

 

You say you aren't dividing?  That is not what I see?  Check the notes I placed in the snippet!

 

Have you done any probes to see what values are on the wire?  Specifically the error wire and the double that goes into the DAQmx Write?

 

0 项奖励
15 条消息(共 18 条)
2,710 次查看

I'm really sorry for my misunderstanding. I check the wire and it returns no error.

 

Capture.PNG

0 项奖励
16 条消息(共 18 条)
2,699 次查看

And what is the value on that orange wire going to the DAQmx Write?

 

And to go back to your original question where you said "But I could only output the first data in the loop".

How do you know it is only outputting the first data?  What is your evidence that something isn't working right?

 

 

0 项奖励
17 条消息(共 18 条)
2,690 次查看

I delete the DAQmx Timing and the vi runs well.

 

I suppose the problem is that the clock could only serve one AO, one AI?

0 项奖励
18 条消息(共 18 条)
2,688 次查看