Quantcast
Channel: All LabVIEW posts
Viewing all 203016 articles
Browse latest View live

Re: Extract string within parenthesis into a numeric array

$
0
0

Thank you so much for your suggestion.  I might use this if I plan on sending both gameobject transform and rotation coordinates from unity which would increase the number of items in my string.  Since I'm only sending transform coordinates the first solution worked great. 


Re: creating 1 million text files in labview

$
0
0

@altenbach

i tried using filename but it generated around 90,000 files in 3 days and after that the system become too slow, windows os was creating trouble and there was a huge data loss because the file generation(create file with increment suffix) was taking a longer time, even i tried to split the files and folder that didn't work because it was even taking a longer time. the main problem is the create file command, as the no files increases the create file command takes longer time and so on...

Re: not measuring voltage

$
0
0

TO  all of you who has helped me in figuring it out the correct way;THANK you.I got it working

Re: Having an executable expire

$
0
0

Consider having the program be two parts.  One is a launcher.  If the date is okay it launches the 2nd executable.

If the date has passed, have it delete the 2nd executable and tell the user that time has expired.

Re: creating 1 million text files in labview

$
0
0

As explained others and by yourself, the speed issue is with the OS, not the program. Windows has speed problems with large amounts of files in one directory.

Re: creating 1 million text files in labview

$
0
0

Something that might help.... Microsoft recommends "If you use large numbers of files in an NTFS folder (300,000 or more), disable short-file name generation for better performance, and especially if the first six characters of the long file names are similar."

Of course a SSD could help too.

However, I will also recommend you reconsider your approach.

Re: Can LabVIEW create .NET managed assemblies

$
0
0

 wrote:

 wrote:

Pretty sure this is what you're looking for


It doesn't mention 'managed' though...


But what would be an unmanaged .Net assembly? Unmanaged means in .Net normally code that is not running in the .Net CLR such as the WinAPI. A .Net assembly generally always executes in managed mode although you can have mixed mode assemblies that contain internally unmanaged code.

However a LabVIEW .Net assembly is always in native code, which means only executable for the processor architecture that the creating LabVIEW version supports, since LabVIEW creates directly native machine code and not .Net IL (intermediate language) code.

Re: creating 1 million text files in labview

$
0
0

Either use far fewer files with lots of data in them or use a database. The OS will choke once you start creating that many files. Not to mention you are wasting a TON of disk space. A very small file will use a 8192 bytes of disk space. In fact, all files will be broken 8192 byte blocks when saved on disk. So if you have 32 single byte files you will be using 256 KBytes of disk space to store them.


Re: List all attached devices

Re: List all attached devices

$
0
0

If you are using it in LabVIEW, you may want to know if it is recognized as an attached device by MAX.  The following code works for DAQmx devices (including Simulated Devices), and there may also be similar Property Nodes that will enumerate Cameras (I haven't looked yet).

DAQmx System.png

Note the "Sample Answers" may be mis-leading -- I ran this on my machine, and Product Category, instead of returning an Enum (which I got by right-clicking and saying Create Constant) actually returns an I32.  Incidentally, this is by no means an exhaustive list of the available Properties, just some examples.

 

Bob Schor

Re: crc32 of a binary file

$
0
0

Here is code that I use for calculating CRCs. Code for calculating both CRC-16 and CRC-32 is included. The CRC-32 is the same polynomial used for Ethernet traffic.

Re: About How to develop Xnode

$
0
0

 wrote:

You'd be much better of spending your time on malleable VIs.

 

XNodes are incredibly difficult to make, and even more difficult to make them do something useful. And then when you succeed, you'll run into the distribution problem. NI uses them, but they can distribute them with LabVIEW. We can't.

 


That's overstated in my opinion.  They are challenging, and fraught with pitfalls (Ctl-Alt-Del becomes your best friend).  But I make them, useful ones (why would I make one that's not useful?).  Also, there's no distribution issue.  (Note that XNodes are only present in source code, their components don't end up in compiled code.)

 

Just for fun I've attached one.  This one is a zero-risk xnode because it doesn't stay on your block diagram, it replaces itself with one of your subVIs.  The tricky part is getting it on your palette (Tools->Advanced->Edit Palette Set...).  In order to get that to work, you have to:

  1. Edit the .xnode file with a text editor and comment out the "Help" item.
  2. Edit the palette set: Right-click on an empty space and select Insert->VI(s)...
  3. Change the browser pattern to All Files (*.*) and select the xnode.
  4. Edit the .xnode file again, restoring the "Help" item.

Have fun.

Re: ni-845x error in labview vi

$
0
0

 wrote:

  why do I have this error?

thanks

 


Which error?  You've told us the Device that (presumably) "threw" the error, you showed us a partial Picture of some code (too small to read), part of the code picture is covered up with a hard-to-read Probe window, the Probe locations aren't obvious on the Picture, etc.  You've also told us nothing about what you are doing (the Picky Details) and what you are trying to do (the Big Picture).

 

I'm going to take a wild guess that its either a Hardware Issue (I'd estimate 15% probability) or a Software Issue (estimated at 85%).  If you want something other than guesswork, please do the following:

  • Attach the VI (or VIs) itself (or themselves).  We learn so much more from a VI than from a picture.  I'll note that not everyone will be able to open your VI (because you may be using a more recent version of LabVIEW than they), but nothing beats the LabVIEW Development System for examining and debugging LabVIEW code.
  • If there's an Error Message, it is helpful to attach a picture of the Message.  It gives us the Error Number and where in your code it failed (useful if you have sub-VIs).
  • If you have a Probe Window, again, a Picture is OK, but we need to know where the Probes are placed.
  • The circumstances that causes the Error can be helpful.  Remember, we're not there looking over your shoulder and able to ask questions "in Real Time".

Something that can be helpful in LabVIEW Debugging is to make tiny routines that do one basic step (like open a device and making a connection).  If that works, add the next step.  Too many people "Write First, and Test When It Is All Done" -- finding a bug in a several-screen program is much harder than in a test routine with 5 LabVIEW functions and structures ...

 

Bob Schor

 

Relationship between Sample Rate/Record Length and time/div on horizontal axis

$
0
0

Well due to the absolutely zero responses about how to set the horizontal timebase using NI-Scope VIs and a NI USB oscilloscope I did a little playing around with the examples and I can see there is some relationship between Sample Rate/Record Length and the time/div horizontal axis.

 

But I can not figure out what that relationship is:

 

My application requires me to have a time/div control for the oscilloscope display just like an oscilloscope has.

Re: Help Performing FFT Spectrum on Logged Data

$
0
0

Update:

I figured out that I wasn't actually plotting frequency versus magnitude, I was plotting magnitude index versus magnitude. I used the equation: f = Fs*(0Smiley SadL/2))/L where f is the frequency domain, Fs is the sampling rate, and L is the amount of samples. So that part of the problem is solved.

 

Only remaining issue is that the magnitude displayed is not the same as the amplitude of the graph as it should be. I believe it has to do with spectral leakage but I don't know how to approach that. Thanks for any help!


Re: crc32 of a binary file

$
0
0

Hopefully the original poster already found an answer to their question, considering their post was from 2009...

Re: crc32 of a binary file

$
0
0

I realize that. But the recent discussion was discussing MD5 and CRCs and it was mentioned they would use MD5 because a solution existed. I simply provided one for CRCs too.

Re: Packed library with non vi files

$
0
0

Sure, in my example the support directory was called "Resources"

I'm trying to get rid of the absolute file path saving method going along with non labview files in PPL.

For now, my solution is to rebuild the PPL on the second computer so the absolute file path becomes valid. Any better option?

Re: Unable to access host data from local computer

$
0
0

OK.  I'm currently a few hundred miles from my RT System, but through the Magic of Remote Logon (not to mention having Subversion to keep the code available), I have a "Model" you can copy.

 

Let's start with the Hardware.  My PC has a second NIC that is used as a Private Network and connected directly to my Real-Time Chassis, a PXI system.  The Host (PC) has an IP of 10.0.0.101 (a 10-dot network is "non-routable" and hence can't go on the Internet).  I gave it a Subnet Mask of 255.255.0.0, meaning it can connect with anything it "sees" with an IP of 10.0.x.x (where "x" is any 8-bit number, 0 .. 255). 

 S-Lab Project.pngS-Lab Sample Stream.png

 

As you can see from my Project, the PXI has an IP of 10.0.1.103 (and a similar sub-net mask), so the two machines can "see" each other.

 

The RT (PXI) side is acquiring 16-bit Analog data and is streaming it to the Host (PC) as an array of 50 I16s.  I have named this string "Smpl" (Sample).  The two functions that create the Reader (running on the PC, top) and Writer (running on the PXI, bottom) are shown above.  You will note that I gave the PC the name "UI" (for User Interface) and the PXI the name "RT" (for Real-Time).  In this Project, I have three other Network Streams that are configured similarly -- what differs is the name of the Stream (e.g. "Smpl") and the type of Data.

 

Note that when creating the Reader on the PC, I don't need to specify the PC's address, but do need to tell the PC where to find the Writer (i.e. the PXI's address).  Similarly, the Writer (on the RT side) doesn't need to know its own address, and once a Reader/Writer connection has been established, you only need IPs for one side.

 

A note about hardware.  The PXI gets started first, and runs its code.  It starts by "listening for a connection" -- if 15 seconds go by without one, it times out and tries again (it can do this for days ...).  The PC "expects" that the PXI, at 10.0.1.103, is "on" and "listening", so when it starts, it tries to connect.  Since you sit at the PC, if the PC fails (three times, or 3 * 15 seconds) to connect, it generates an Error Message ("Turn on the PXI, Dummy!") and aborts.

 

Hope this clarifies things and you get your streams to connect.  The question about Network Addresses and Subnet Masks definitely have to do with how you are connected to your cRIO.  I noticed that your Host and cRIO had very similar IPs, one with a final octet of 1, the other of 2.  The subnet mask 255.255.255.248 means that the addresses have to match except for the last three bits of the last octet.  Since 1 is 000001 in Octal, and 2 is 000002, they only differ in the last three bits, so they should match.  But how are they connected?  Is it a "private line", or are they plugged into a "normal" network?  If they are directly connect by a cable, it must be a crossover cable (you can recognize these by holding up the "ends that plug in" and noticing if the colors on the wires have the same order -- regular cables will "match", but crossovers might have Orange on the outside on one plug, and in the middle of the other).  Because Crossover Cables are "rare" (for good reasons!), I usually use two regular cables and an inexpensive 4-port "hub" which serves to do the crossover for me (at around $30, these mean you never worry about the Cable -- if in doubt, throw it out and try another one).

 

Bob Schor

Re: Finding a energy from FFT Labview

$
0
0

You put the answer to your dilemma right on the Front Panel of your VI -- "Freq Resolution = 10 Hz".  The FFT estimates the component of the signal in 10 Hz bins, so you have some "signal" at 80 Hz, some at 90 Hz, some at 100 Hz, some at 110 Hz, some at 120 Hz.  The biggest peak will be at 110, which is closest to 105.1 Hz, but it's a "crude" estimate, so you can't expect it to be precise.

 

Suppose you sample 20,000 points at 1 kHz, for a resolution of 0.05 Hz.  Your FFT would be a single "sharp" peak, with magnitude of 0.7071 (which you might realize is sqrt(2)/2, the correct answer).

 

Nothing wrong with your code, you just don't know how/when to use an FFT.

 

Bob Schor

Viewing all 203016 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>