Jump to content


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

postformac's Achievements


Newbie (1/14)



  1. I am distributing an exe and looking to provide the end user with the ability to set-up their own input channels to read through a cDaq / cRIO. I know that I can distribute MAX with my installer which gives the end user the ability to configure their own channels. What I can't figure out is how to deal with this in my program to be able to read the samples as I don't know what the channels are in advance. I have been experimenting with the DAQmx property nodes and can read the available tasks / channels / channel types from the attached hardware, however I'm not sure how to deal with the various sample rates etc to get a read on all of the channels. Two questions - Is there a simpler way to just "sample all available channels" or do you have to do this manually per channel through the property nodes? If doing it manually through property nodes, could someone advise me on how to deal with the differing sample rates from different tasks? For example, I have one task set at the moment for a number of thermocouple inputs that are all at 10Hz and a separate task for a counter input that is only running at 2Hz. If I try to use a 10Hz loop to read each one in turn I get a big delay every time it samples from the counter task as it is not ready yet. If I was hard coding it I would just have two loops running at different rates but I can't figure out how to do this if I don't know it is needed in advance. Any help would be appreciated, thanks.
  2. Ok I get it, I think your way is better as it means I don't have to hard code all of the IDs in advance, it will just populate as it goes and generate a new cluster for whatever messages are on the bus. I have never used clusters before but they are looking pretty useful right about now, I will have to play with them some more... Thanks very much for your help!
  3. Oh no, I see what you mean. You mean to create my own lookup table just using an array or whatever, like this right? Thanks Sorting array-2.vi
  4. Ok, I think I understand what you have done. Basically you have created an array of clusters, with one cluster for each ID where each cluster contains a 1D array that specifies the row number(s) that the ID occurs on and a count of how many times that ID occurs in total. Then you use that to extract the information again at the end from the original array to create another array containing clusters of 2D arrays.... An array of clusters of arrays, why didn't I think of that ha ha. Seriously though that works really well, I would never have thought of it myself so thanks for your help. When you say in your note to create a lookup table if the IDs are not concurrent (which in reality they aren't) is there actually such a thing as a lookup table in labview or do you just mean to go through the array one row at a time and replace the IDs with pre-determined values manually (such as via a case statement)? Thanks, Mark
  5. Thanks very much for the replies guys. I have had a look at the example you posted Ned and its got lots of stuff in it I have never seen before so it might take me a while to digest! It does sound like a good way to do it though so I will have a go at repeating what you have done. Thanks
  6. I am having difficulty figuring out how to sort an array according to one of the columns, I'm sure there's a really easy way to do it but I can't think of a nice solution that doesn't use loads of memory! I have a large array that contains data from a CAN bus. Each line has the message identifier and 8 bytes of data. All I want to do is to split the array up so I end up with separate arrays each with all of the data for one individual message identifier. I have attached a quick VI that demonstrates the principle. This VI works fine and does what I am intending, but the actual files of CAN data are thousands of lines long and could contain upto around 30 different identifiers depending on how many nodes are active on the bus and what messages are present. That would mean that I would need to pass 30 arrays back around every iteration of my loop, some of which may contain thousands of lines of data depending on how active the ID is. It ends up being quite slow, I assume because I am sending so much data round and round my loop on each iteration. I would prefer to just terminate all of the possible array lines at auto-indexed tunnels at the edge of my loop so that I'm not passing that data back and forth. I can't work out how to make it operate like this though as I still need some output to send to every tunnel on each iteration, not just the tunnel of the identifier that the current line being examined refers to. I could output some kind of constant to all the other tunnels but then I have to go back through and remove all of the unwanted constants from each array afterwards. I'm sure there must be a better way to do this, could anyone suggest anything? Thanks Sorting array.vi
  7. Ok I got it to work with supressing alerts after following what is happening in the Save Workbook.vi as you suggested. I had to alter one if the VIs to give me the correct refnum as an output though, I couldn't put the reference that is currently output from all of the Excel VIs straight into my property node as it is an "excel object reference" and I needed an "Excel. _Application" reference. I don't really get the difference so I'm not sure if I have done the right thing there, it seems to work fine so its not really a problem but I just thought I would ask if there is a better way to do it like convert the reference or something. Thanks
  8. Hi ooth, Thats brilliant, thank you very much for your help and time. I had noticed the problem with leaving references open and ending the program half way through, so I have added the destroy all references vi at the beginning of my vi as you suggest. One thing with the delete sheet vi, at the end of my program I am left with an open copy of excel that has a message window asking the user to confirm the deletion of the sheet(s). My program stays running until the user either confirms or cancels the delete operation. Is this correct? Its not a big problem obviously. Thanks
  9. Thanks very much for the reply, I have re-arranged your program a bit to make it better suit my existing program that I am adding it into but basically you have given me exactly what I needed. The Excel VIs give all of the functionality I need without the hassle of having to do the ActiveX stuff myself, much easier! The only thing I can't find a VI for is to delete a specific worksheet, is there another way to do that? I just want to remove the blank original worksheets after I have finished adding all of my new ones. Are these VIs part of the NI report generation toolkit or where are they from? Thanks again for the help, I've been struggling with that whole ActiveX thing for a while!
  10. Hi, I know there have been a lot of posts on here relating to Excel and ActiveX but I couldn't find anything that showed exactly what I am looking for. Basically I am trying to write an array of data to an excel file but there are a number of steps that I want to go through first, I can open the reference to Excel, create a new workbook, create a new worksheet and write my data but what I can't manage to find is how to copy an existing worksheet to a new one and re-name my new worksheet. I have no concept of how ActiveX works, I have basically just copied what I have found in other posts and LabView examples so far.... What I want to do is the following: Open an existing workbook (template) Copy the first worksheet in that workbook (which will have a template layout and set calculations) Paste as a new worksheet with my array of data added in the correct place Rename the new worksheet to a name created in my program Repeat for a number of further worksheets with further arrays of data Save the workbook by a different name to preserve the template file In my VI at the moment I have tried to use the "copy" method for the "excel._worksheet" class which does copy the correct worksheet but then puts it in a new workbook instead of adding it to the existing one and my array is added to the existing worksheet rather than the copied one. I don't seem to be able to put any input into the "before" or "after" nodes on the _worksheet invoke node, any data type that I connect to it gives me an error message and stops the program from working. I have looked at the Excel object model map here http://msdn.microsof...y/bb332345.aspx but I have no idea what it means, is each column a subsiduary of the previous one or what? I don't get what I am looking at. I have attached my files so far, could someone give me some pointers on this or show me where to get further information on how the whole ActiveX thing works? Thanks Write Excel simple.vi Write Excel.vi Template.zip
  11. As another question on the same theme - I am basically using my table to display a 2D array of strings opened from an external file. If I want to use the row and column headers to simply number the rows and columns is there an immediate way to do this or do I need to create two 1D arrays that contain all of the necessary numbers? My 2D array of data will vary in size depending on which file is opened so there is not always the same number of rows or columns. I know I can check the dimensions of the array and then create the necessary 1D arrays of numbers using loops but I'm just wondering if there is a more direct way to do it? Thanks
  12. Oh I see, I had been creating the inputs manually I didn't realise you could do it like that. Problem solved, thank you very much for your help!
  13. Hi, I am using a property node to format the row and column headers in my tabe and I can't get the CellJustify property to work properly. The help documentation says the input should be an unsigned word Enum and the allowable values are Left, Center and Right. If I set an enum constant to Left then it works fine, if I change the same constant to Center or Right then I get a broken wire with the error "enumeration conflict". Could anyone please tell me why? Also I have coersion dots on my two ActiveCell inputs to the property node and I don't know why. I have followed the data types set in the help. I notice that the example program provided (linked from the help for the ActiveCell property) also has coersion dots on this input, is this how it should be? Thanks
  14. Thank you Francois, I will have a play with that. Dblk - I tried your file and although it may not be as quick as Francois method (still way quicker than mine!) it is useful in that it does not rely on fixed column widths. I tried a number of different configurations with the piece of equipment that is logging the data and actually the width of the first column is adjusted to suit however many samples you set as a maximum on the hardware. For this reason I think I will go with your method as it is more adaptable regardless of how the hardware is set up. Thanks both very much for your help!
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.