Ano Ano Posted March 21, 2011 Report Share Posted March 21, 2011 Hello, I am designing a threshold detector with 10 inputs. When the threshold is reached (and passed) there will be two data values. 1. The time it takes for each input to pass the threshold limit 2. The time starting from the threshold passing till the STOP button is pressed. 3. The total duration from the start of running till the STOP button is pressed. The I want to export to Excel these times and make a column for each of the 10 inputs. Also I need the vi to write to excel after the stop button is pressed. How can I do all these? Quote Link to comment
Cat Posted March 21, 2011 Report Share Posted March 21, 2011 If the requirement is not to specifically make a *.xls file, but rather just a file that Excel can read, the easiest way to do this is to make a Comma Separated Variable (*.csv) file from your data. Then you don't have to fool around with ActiveX or .Net or anything like that. So, for example, your time file would end up looking something like timeToThreshold1, timeToStop1, duration1 timeToThreshold2, timeToStop2, duration2 timeToThreshold3, timeToStop3, duration3 ... 1 Quote Link to comment
Ano Ano Posted March 21, 2011 Author Report Share Posted March 21, 2011 If the requirement is not to specifically make a *.xls file, but rather just a file that Excel can read, the easiest way to do this is to make a Comma Separated Variable (*.csv) file from your data. Then you don't have to fool around with ActiveX or .Net or anything like that. So, for example, your time file would end up looking something like timeToThreshold1, timeToStop1, duration1 timeToThreshold2, timeToStop2, duration2 timeToThreshold3, timeToStop3, duration3 ... Thank you for the prompt reply! How do I make the vi to write to excel after the stop button is pressed, ie after all the data is collected? It keeps asking me to save the data at the beginning. Quote Link to comment
Roderic Posted March 21, 2011 Report Share Posted March 21, 2011 You just have to place the write to excel fonction after your loop... Quote Link to comment
Cat Posted March 22, 2011 Report Share Posted March 22, 2011 You just have to place the write to excel fonction after your loop... What Roderic says. And if you use *.csv, you can use "Write to Text File" function in the File I/O Palette. Quote Link to comment
Ano Ano Posted March 23, 2011 Author Report Share Posted March 23, 2011 Thank you all for your replies How can I write each waveform/array to a different column in excel? Quote Link to comment
Cat Posted March 23, 2011 Report Share Posted March 23, 2011 How can I write each waveform/array to a different column in excel? wave1, wave2, wave3 w1pt1,w2pt1,w3pt1 w1pt2,w2pt2,w3pt2 w1pt3,w2pt3,w3pt3 w1pt4,w2pt4,w3pt4 etc... Quote Link to comment
Ano Ano Posted March 23, 2011 Author Report Share Posted March 23, 2011 wave1, wave2, wave3 w1pt1,w2pt1,w3pt1 w1pt2,w2pt2,w3pt2 w1pt3,w2pt3,w3pt3 w1pt4,w2pt4,w3pt4 etc... How do I implement it to labview? Quote Link to comment
Cat Posted March 23, 2011 Report Share Posted March 23, 2011 How do I implement it to labview? I think we've gotten to the point where you need to post some code of how you've tried to implement the suggestions Roderic and I have already made, and what's working and what's not working. Quote Link to comment
Ano Ano Posted March 23, 2011 Author Report Share Posted March 23, 2011 I think we've gotten to the point where you need to post some code of how you've tried to implement the suggestions Roderic and I have already made, and what's working and what's not working. I made it work (see Attached Picture) Where you talking about another way? Is there another way to make this, perhaps more simple? Quote Link to comment
Cat Posted March 23, 2011 Report Share Posted March 23, 2011 Where you talking about another way? Is there another way to make this, perhaps more simple? There are a whole bunch of comments I could make, but first of all, what is this project for?? Work? School?? Quote Link to comment
Roderic Posted March 24, 2011 Report Share Posted March 24, 2011 (edited) Indeed, there's different ways to do this. and I dont think this is the simpler way, but if it works then... You seem to use an indicator as a control for the file path... or maybe I dont have the whole picture. Your design is a bit weird to me. Edited March 24, 2011 by Roderic Quote Link to comment
Cat Posted March 24, 2011 Report Share Posted March 24, 2011 Your design is a bit weird to me. The code almost looks deliberately wrong, which makes me wonder if it's a school assignment??? If so, while we're all glad to help people out here, we really shouldn't be doing your homework for you. Quote Link to comment
Ano Ano Posted March 28, 2011 Author Report Share Posted March 28, 2011 (edited) The code almost looks deliberately wrong, which makes me wonder if it's a school assignment??? If so, while we're all glad to help people out here, we really shouldn't be doing your homework for you. Its work! What you see is a patch work from different other vi/examples etc, and no it is not "deliberately wrong"! Indeed, there's different ways to do this. and I dont think this is the simpler way, but if it works then... You seem to use an indicator as a control for the file path... or maybe I dont have the whole picture. Your design is a bit weird to me. It is an indicator, the file path is generated via a path/tag code. I chopped it off as I thought it might be confusing Edited March 28, 2011 by Ano Ano Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.