LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Core 1 v2015 Exercise 9-4B and 9-4C

Help me please, having a lot of trouble on figuring out where to start with these. If you could include code and an explanation that would be much appreciated. These are the exercises:

 

Exercise 9-4B Challenge
Goal Create a VI that takes the property name as input and returns the associated property value.
Scenario Your file header includes a variable number of property names and values. After reading the file, you want to programmatically access the property value for a given property. For example, in this exercise, one of the properties was “UUT Serial Number”. You want to programmatically search for “UUT Serial Number” and then return the serial number value (e.g., “A12345”).
Description After reading the spreadsheet string into memory, use a modular approach to create a VI which finds the row index of a property name. Then use the row index to return the property value. If the property name isn't found, the VI should return a descriptive error.

Exercise 9-4C Challenge
Goal Create a VI that creates tab-delimited column headers for an arbitrary number of channels.
Scenario The MultiChannel Write VI can write data for an arbitrary number of channels using a two dimensional array. You want to create a channel header for each channel of data. Since the number of channels is arbitrary, you need a scalable approach which allows for a variable number of channel headers. For example, if you have three channels of data—temperature, pressure, and strain—you want to write the data to a file with the following headers: Temperature, Pressure, and Strain. To format the file correctly, you want to use the same delimiters in the header as in the channel data. For example, if the channel data is tab-delimited with each line terminated with an end-of-line character, you want your header to be formatted the same way.
Description Create a Write Channel Data with Headers VI which you call prior to your MultiChannel Write VI that writes a channel header for each channel of data. The VI should take an array of strings as input. Your subVI should write the strings to file so that a tab separates each string and the line is terminated by an end-of-line character.

0 Kudos
Message 1 of 16
(4,033 Views)

I'm confused about what is wanted in Challenge 9-4C.  To do the part starting from the word "Description" (about 2/3 down) in LabVIEW 2018 takes very few functions and even fewer structures.  If you don't know how to get started, then go back to the Tutorials and pay close attention to the File I/O functions.

 

Bob Schor

0 Kudos
Message 2 of 16
(4,025 Views)

@mshask wrote:

Help me please, having a lot of trouble on figuring out where to start with these. If you could include code and an explanation that would be much appreciated. These are the exercises:

 

Exercise 9-4B Challenge
Goal Create a VI that takes the property name as input and returns the associated property value.
Scenario Your file header includes a variable number of property names and values. After reading the file, you want to programmatically access the property value for a given property. For example, in this exercise, one of the properties was “UUT Serial Number”. You want to programmatically search for “UUT Serial Number” and then return the serial number value (e.g., “A12345”).
Description After reading the spreadsheet string into memory, use a modular approach to create a VI which finds the row index of a property name. Then use the row index to return the property value. If the property name isn't found, the VI should return a descriptive error.

Exercise 9-4C Challenge
Goal Create a VI that creates tab-delimited column headers for an arbitrary number of channels.
Scenario The MultiChannel Write VI can write data for an arbitrary number of channels using a two dimensional array. You want to create a channel header for each channel of data. Since the number of channels is arbitrary, you need a scalable approach which allows for a variable number of channel headers. For example, if you have three channels of data—temperature, pressure, and strain—you want to write the data to a file with the following headers: Temperature, Pressure, and Strain. To format the file correctly, you want to use the same delimiters in the header as in the channel data. For example, if the channel data is tab-delimited with each line terminated with an end-of-line character, you want your header to be formatted the same way.
Description Create a Write Channel Data with Headers VI which you call prior to your MultiChannel Write VI that writes a channel header for each channel of data. The VI should take an array of strings as input. Your subVI should write the strings to file so that a tab separates each string and the line is terminated by an end-of-line character.


You first.

 

Edit: What I mean is, show us what you've tried, and if you are so perplexed that you don't have starting code, at least try to explain to us what is stopping you from putting down at least one node on the block diagram.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 16
(4,007 Views)

I don't know what a property name and I don't know how to return that. For the second exercise, I don't know what tab-delimited column headers or channels are or how to use them. This is my first time creating labview code so I would really appreciate a little help. I've exhausted my resources for trying to solve these challenges.

0 Kudos
Message 4 of 16
(3,996 Views)

Do you mean to say that after carefully reading all of the material that is presented in Core 1, you have no idea how either question should be answered?  For the second question, did you carefully read the material on File I/O?  Did you try to write any simple LabVIEW code involving opening files, reading, writing, etc.?  Did you look at the names of all of the functions on the File I/O Palette?  Do you know how to get further help (from the LabVIEW Help system) for a Function you don't understand?  Have you looked at the relevant examples that ship with LabVIEW?

 

Learning to program (in anything) takes a little effort, some reading, some thinking, and a fair amount of trying (as in "Trial and Error").  Show us something that suggests you are serious ...

 

Bob Schor

0 Kudos
Message 5 of 16
(3,986 Views)

Listen, I'm not trying to get answers to assignment or anything, I would just like some help. I'm learning LabVIEW for my first job and I would really appreciate if you didn't ask if I did all these things because I did. I really want to understand it and it's my first week using labview. I am not a professional and I don't appreciate you acting like I'm some kind of incompetent person. I have ADD so it's really hard for me to pay attention and retain information sometimes and interpret some things so I really would just like some help or guidance, even something like which function to use. I have included my attempt for 9-4B, working on 9-4C. What I am not sure about is how/where to search for a UUT serial number? Thanks

Message 6 of 16
(3,979 Views)

Version:1.0 StartHTML:000000251 EndHTML:000028571 StartFragment:000027596 EndFragment:000028394 StartSelection:000027596 EndSelection:000028394 SourceURL:https://forums.ni.com/t5/LabVIEW/LabVIEW-Core-1-v2015-Exercise-9-4B-and-9-4C/m-p/3808636 Re: LabVIEW Core 1 v2015 Exercise 9-4B and 9-4C - Discussion Forums - National Instruments

This is the exercise below. I have included the code I have so far, not sure how to create/read the file which searches UUT serial numbers, if someone could help with that or sees any errors in my current code that would be appreciated.

 

Exercise 9-4B Challenge
Goal Create a VI that takes the property name as input and returns the associated property value.
Scenario Your file header includes a variable number of property names and values. After reading the file, you want to programmatically access the property value for a given property. For example, in this exercise, one of the properties was UUT Serial Number. You want to programmatically search for UUT Serial Number and then return the serial number value (e.g., A12345).
Description After reading the spreadsheet string into memory, use a modular approach to create a VI which finds the row index of a property name. Then use the row index to return the property value. If the property name isn't found, the VI should return a descriptive error.

0 Kudos
Message 7 of 16
(3,954 Views)

Core 1 has a section called "Working with Multichannel Text Files".  One of the sub-lessons is called "Given a Property Node, Find the Value".

 

To my surprise, this lesson does not talk about the Spreadsheet Functions (important for the second problem).  Look at the first two functions on the LabVIEW File I/O Palette.  If you put them on a Block Diagram, you can right-click them and bring up LabVIEW Help, which will explain the functions to you, and should also point you to Example Code within LabVIEW.

 

The problem of writing a file consisting of three headers, separated by tabs, and ending with a Carriage Return/Line Feed, requires a single LabVIEW function and no LabVIEW structures (such as a While Loop or Case Statement).

 

Bob Schor

0 Kudos
Message 8 of 16
(3,959 Views)

For what you said for 9-4B, what functions are used to call the spreadsheet file in array form, the property name, and property value? Are they strings in which I just have to type in the file name and the header I want to access?

0 Kudos
Message 9 of 16
(3,950 Views)

Please don't attach GIFs.  It would have been much better to have actually created this code from the Core 1 tutorial in LabVIEW, yourself, and attached your VI.

 

My previous post answered the question about how to get the contents of the Spreadsheet File as a String Array.  Here's a picture:

Read Delimited Spreadsheet.png

Bob Schor

0 Kudos
Message 10 of 16
(3,934 Views)