postformac Posted March 16, 2009 Report Share Posted March 16, 2009 Hi, I am new to labview and am currently working on a project that analyses the data from an input array and lists the analysis in a table (lists array element positions and values that fall ouside of a pre-defined spec). It all works fine, however I want to stop the user from being able to edit the table data after the program has run as having output data editable by the user kind of defeats the purpose of analysing it in the first place.... The table is set as an indicator, I know I can do this by outputting as a 2D array instead of a table but then I don't get the column headings. Is there any way to do this or are tables (even as indicators) always editable? Thanks Quote Link to comment
Mark Yedinak Posted March 16, 2009 Report Share Posted March 16, 2009 I am not sure what you are doing specifically but if the table is an indicator the user can't edit the cells. Unless you are referring to them editing it in the development environment. In that case there isn't too much you can do. One thing you can do is to lay a transparent control over it, disable it and place it in front of the table. Of course i they are in the development environment they have full control over the source and can simply move your transparent control to the back or hide it. The only real way to prevent the user from editing your controls is to build your program into a stand-alone application. That way you have full control over it. Quote Link to comment
postformac Posted March 16, 2009 Author Report Share Posted March 16, 2009 Oh ok, thanks. I hadn't actually built it yet I was just running it from the development environment, I didn't realise the edit would be disabled once it was built! That solves that then.... Quote Link to comment
postformac Posted March 18, 2009 Author Report Share Posted March 18, 2009 Actually, one more question on the tables - I am building my table from a 2D array of integers (ie. no decimal places and the arrays used are set to "long" representation). It works fine but the data in the table is displayed to 6 decimal places which is pointless considering the input data. I know how to change the data type of numeric controls / indicators using the representation setting but I cant figure out how to change this for the table. There is no representation option on the right-click menu and in the block diagram the "convert to dynamic data" block that appears infront of the "build table" block only gives the options for the scalar data type to be either floating point or boolean. Is there a way to change this so that the table just displays integers without the decimal point? The way it is at the moment also causes a red dot at the connection point on the "convert to dynamic data" block which I assume is due to the mismatch in data types? Thanks Quote Link to comment
Mark Yedinak Posted March 18, 2009 Report Share Posted March 18, 2009 Simply right click on one of the array elements and adjust the display format for it. This will change the setting for all of the elements. Quote Link to comment
postformac Posted March 18, 2009 Author Report Share Posted March 18, 2009 Thanks but the data type of the array is correct to only be integer numbers, I want to change the display of the table and the option to change the display format is not given on the right click menu for the table. Oh actually I found it, I can right click on the table in the block daigram and change the data type to integer. I still have the red dot on the "convert to dynamic data" block though and the only options on the properties for input data are still floating point and boolean. Is there any way to fix that? Thanks Quote Link to comment
Mark Yedinak Posted March 18, 2009 Report Share Posted March 18, 2009 QUOTE (postformac @ Mar 17 2009, 01:16 PM) Thanks but the data type of the array is correct to only be integer numbers, I want to change the display of the table and the option to change the display format is not given on the right click menu for the table.Oh actually I found it, I can right click on the table in the block daigram and change the data type to integer. I still have the red dot on the "convert to dynamic data" block though and the only options on the properties for input data are still floating point and boolean. Is there any way to fix that? Thanks Well my suggestion was not actually changing the data type of the 2-D array. It was still a 2-D array of doubles but what was being changed was how the data was display. My suggestion would display the data as if it were integers. Sometimes you don't have any issues when you have coercion dots but other times you do. I would try to avoid them in your code since you can get unexpected results when coercing data from one type to another. So, if you leave you data as double my earlier suggestion will modify the display so that they appear to be integers. If you change the data type of the array I recommend that you make sure you use a consist data type in your code and avoid coercion dots. Quote Link to comment
Neville D Posted March 18, 2009 Report Share Posted March 18, 2009 Coercion dots especially for large data types like arrays can be a problem at run-time, when the Memory Manager might have to be invoked. This can affect the performance of loops especially if the arrays are large. To be safe, coerce the data to the required type from: Numeric pallet>Conversion> and select the right function to coerce your data to the correct type. N. Quote Link to comment
postformac Posted March 19, 2009 Author Report Share Posted March 19, 2009 Mark, Sorry, I think we are crossing wires somewhere.... I have two lots of data, one lot of input data in a 2D array of integers which is stored as integers and displayed as integers, no problems there. The input data is analysed by my code and the results are output into a separate table (not an array). The output results in the table should also be integers as they simply list element numbers and values from the input array, the problem that I was having was that the output table (as an actual table indicator not a 2D array indicator) was showing the output data as floating point instead of integer values. I fixed that by changing the "format for numeric table data" found in the properties of the "build table" block on the block diagram. I realise I could have just made the input array floating point but that would just use up more memory space and should not have been necessary. I was still having a problem however as the table requires an input of dynamic data type. When you add the table it automatically includes a "convert to dynamic data" block to swap whatever data you have into dynamic data. The only options for data types to input into the "convert to dynamic data" block are boolean and floating point, no option for simple integer values. It still worked but I had the coercion dot. Now following Nevilles' suggestion (thanks) I have added a block that converts from integer to double float just before the dynamic data block. That has removed the coercion dot, I am wondering though if it increases memory usage? Not that its really an issue as there isn't that much data being processed but I code a lot of embedded stuff so I'm just used to always using the smallest possible data type for whatever I need. Is the conversion only temporary until it is output in the table or is the converted (and now expanded) data held in memory still? Thanks both for all the help! 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.