multiply the channels with a constant

Hello

I want to multiply all my channles with a constant value say 4.3

So I thought to generate a new string with all its value as 4.3 and multiplying this channel with my current channel. I used

Dim MyChnName, I have

MyChnName = ChnAlloc ("Mass", 2400, 1, DataTypeFloat64, "Numeric") ' Allocate channel of text
For i = 1 to 200
CHT (i, MyChnName (0)) = "4.3" & I "create value of text
Next

But it generates values as 4.31, 4.32... 4.3XXX

I want that all the values are constant. How can I modify my code to do this?

Or multiply all my channle with 4.3 values directly (without creatine a channel) how to move forward with this?

Hi Rash.patel,

Do you really speak a text - which means «abc123...» » ? According to me, not because you set a digital channel with chnalloc. And in the next line, you connect traction chains:... = '4.3' & I. VBS connection string is just the strings together as "abc" & "123"-> "abc123". I think that this is not what you want to do. If you use a loo, you must set:... = 4.3 + i

But in general, you must use the DIAdem Standard mathematical functions because they are much faster than looping through the unique string values.

In the DIAdem mathematical basis, you will find the functions you need, like scaling, offset correction...

Greetings

Walter

Tags: NI Software

Similar Questions

  • How to multiply the channel by variable

    Hello

    I have a timestamp that is not real time, but the next number. I know that the interval (such as 1 or 10 seconds) of the measures. So I am this conversion to standard time. In this case, I need to multiply this channel by given interval. It's easy, because you can multiply the channel by a constant like below:

      Call ChnCalculate ("Ch(""[2]/Seconds1"") = Ch(""[1]/#"") * 1")
    Call ChnCalculate ("Ch(""[2]/Minutes1"") = Ch(""[2]/Seconds1"") / 60")
    Call ChnCalculate ("Ch(""[2]/Hours1"") = Ch(""[2]/Minutes1"") / 60")

    But how to do this using the variable? Let's say we have variable s_interval and we want to put this variable instead of multiplying it by constant.

    Ch(""[1]/#"") * 1 ")

    Do you know how to do this?

    Best regards

    Piotr

    Hi Piotr,

    You can set it like this:

    Dim dFactor
    Call ChnCalculate ("Ch(""[2]/Noise_1"") = Ch(""[2]/Noise_1"") /"& dFactor ")

    But I prefer a DIAdem function for this calculation, because it is faster using a well-defined function than the calculator.

    Dim dFactor, dOffset
    dFactor = 10
    dOffset = 0
    Call ChnLinScale ("[1] / Time", "[1] / Time", dFactor, dOffset)

    or if you use the channel object:

    Dim oChn, dFactor, dOffset
    Set oChn = Data.GetChannel("[1]/Time")
    dFactor = 10
    dOffset = 0
    Call ChnLinScale (oChn, oChn, dFactor, dOffset)

    Greetings

    Walter

  • re4000w and setting the channels with wrt54gl

    Hello

    Could someone help me I have a wrt54gl and want to use re 4000w, is it possible, that I can't see ay area set the channel on re4000w.

    Set to auto dhcp, or this unit only works with wrt54gl in static mode?

    Tony

    RE4000 Getway should be 192.168.2.1

  • How to make a good UI for the selection of the channels with DAQmx

    A lot of my Labview programming accompanied verisons them previous LabVIEW (pre Labview 7), and there are a ton of new features I am digesting (currently using Labview 8.2).

    My question is (in general), how people schedule their user interface for the selection of channels and others when using hardware DAQmx?  What I have in mind is a system compacDAQ with a number of modules.  The user would be able to choose which channels to watch.  With the help of MAX as part of this process seems counter intuative and somewhat static (yes I know you can change out there, but it feels more like something you would use for something that doesn't really change much).  I wish that all the UI within the VI.

    Programmers use the task of creating screw for this or something else?

    Thanks in advance.

    ChuckNRC,

    I tend to avoid using MAX and create all my channels/tasks using the DAQmx functions.  There are also having some DAQmx features that allow you to save/remove channels, tasks and scales to MAX.

  • Make the color with location constants

    Hi all

    I developed a simple application that uses the location. It works perfectly.

    But now I want that I fixed the backgruond of the textfield color, put on my screen. So I want to define this constant of color, like Color.DARKGRAY, in file .rrh & .rrc. But it gives exception when I try to extract the value of the .rrc file & wraping who in the connection string.

    Can you give me an idea about it? Here I write my sample code.

    import net.rim.device.api.i18n.ResourceBundle;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.component.Dialog;
    import net.rim.device.api.ui.component.LabelField;
    import net.rim.device.api.ui.component.RichTextField;
    import net.rim.device.api.ui.container.MainScreen;
    
    public class Local extends UiApplication
    {
        public static void main(String[] s)
        {
            Local local = new Local();
            local.enterEventDispatcher();
        }
    
        public Local()
        {
            pushScreen(new LocalScreen());
        }
    }
    
    final class LocalScreen extends MainScreen implements LocalDemoResource
    {
        ResourceBundle resourceBundle = ResourceBundle.getBundle(BUNDLE_ID, BUNDLE_NAME);
        public LocalScreen()
        {
            LabelField labelField = new LabelField(resourceBundle.getString(CONTENT), LabelField.ELLIPSIS);
            setTitle(labelField);
            RichTextField richTextField = new RichTextField(resourceBundle.getString(MESSEGE), RichTextField.EDITABLE)
            {
                public void paint(Graphics g)
                {
                    try
                    {
                        g.setBackgroundColor(Integer.parseInt(resourceBundle.getString(COLOR)));
                    }
                    catch(Exception e)
                    {
                        Dialog.alert("Bye..");
                        System.exit(0);
                    }
                    g.clear();
                    super.paint(g);
                }
            };
            add(richTextField);
        }
    }
    

    For constant color, I put the 'COLOR' kye & its value as Color.DARKGRAY in the .rrc file.

    Thanks in advance.

    Kind regards

    Craig

    You are welcome.

    If your problem solved you can mark it so?

    Concerning

    Bika

  • multiplying the elements of an array with their index

    How can I multiply the elements of an array with their index values.

    Thanks in advance.

    Hi aksoy,.

    Multiply the elements with their index:

  • In the VI library OR: extract, control of the channel numbers are loaded automatically every time that the VI is open with "count to five: a 2 three 4.0 five." Whence this string of data?

    Even after the removal of the string "count to five: a 2 3 4.» 5."since the control of the chain and its replacement by another string, the original string returns after that the VI has been saved then reopened. Whence this string of data? I have attached a copy of the library feature. In my application, I was able to work around the problem by replacing the chain with a constant string control. But I'm still curious to know what is happening.

    Thank you
    Chuck

    Chuck,

    Chain drive was scheduled by default with the string you see.  To change it, enter the new string, right-click on the control and select

    Operations on the data > default font of the current value

    Now, save your vi.

  • TDMS read fails on the channels of different lengths

    Experts in LV...

    It seems that there is an error in the PDM to read functions.   I have a TDMS file generated by a built executable, this file has a group of 9 channels.  Channel 5 is data taken at a higher rate (IE 20 MHz) compared to the date in the other 8 channes (1 Mhz).  1 Mhz channels have 110 000 points, of course, the 20 Mhz channel has 2 200 000 points.

    If I read this by using the playback feature TDMS passing an array of the names of Channel 9.  It runs and returns a table of 9 waveforms with Y0 dt values correct and the correct.  However Channel 4 (the 5th string, that long) a garbage in the data for all points since the stop the 110 000 in other channels.  This trash is as numbers-10 ^ 304 and zero.  The first 110 000 points are correct.

    The file itself is not damaged.  If I read the file in a loop 1 channel at the time, and to build the table of waveforms I get all 9 waveforms and the correct data of variable length.  A trivial example to read the actual data file is attached with the data file (I hope that boards that leave be attached).  Intrigue albums has corrupted data to read it all-in-one and the bottom has the accurate version of loop data.  The waveforms of tables on the left show that corruption occurs precisely at the location 110 000 table where the other tables

    Yes, the data file is too long for the forums.  You can get the program file and the simple example data

    TDMS error.zip

    No Council or if it is a real mistake.  I don't see anything in the documentation that I'm doing something wrong.  The fact that it returns a length of valid array and no error code is leads me to believe it's a bug of LV.

    Hi sth.

    Thank you for your results. The issue you reported is for playback of several channels of scaling in staircase once. (PDM read on several channels in staircase of unscaling works very well). The .tdms file, you provided, including the scaling of the data.

    I can give you two workaround solutions. The first is what you mentioned, read each channel of scale inside a loop. The second is that always read all channels once, but rank all length strings in descending order. (The first is the channel with a maximum length; the last is the channel of a minimum length).

    Kind regards

    Jie

    OR R & D

  • When I subtract two numbers DBL and try to compare the result with another DBL, it fails

    I found a curious problem with subtraction and compare numbers DBL in LabVIEW (8.6). Here's how it works:

    1. subtract two numbers DBL such that the result is not incorporated. (Say, 3.2 - 3.1)

    2. compare the result with a constant/control that is on the result of the subtraction (in the example, 0.1)

    3 see the output of the comparison.

    If the result of the subtraction is an integer, the Boolean result is (as expected). If the result is not complete, the comparison fails.

    (Now, if I simply compare two floating point numbers, it works, so the issue is not with the node comparison itself, but with the data that is entered to the node). Can someone understand why this happens? It's unexpected, it's a pretty serious bug.

    It is provided with all programming languages. Numbers do not have an exact binary floating-point representation. This has been discussed endlessly. Never use the equal function with floats. You can use the function in the range and force.

  • Media Center problem because it does not change the channel

    I recently changed my dish satellite Direct who changed the channel to 3 4.  My Media Center on my desk, I cannot change just the channel without going through the entire installation, which also requires a configuration for "Câble IR" which, for some reason, it does not.  Therefore, the only option I have given is 'back' or 'Cancel '.  'Back' has no effect except to find the IR cable, in vain.  'Cancel' I shot with no changes!  I'm stuck.  All I want to do is change the channel to receive the TV signal.  Help, please.

    Thank you, Ernest Smith

    Sorry, stupid.  All I had to do was change the channel with the remote control.

  • Extract and save all the channels of the PXI-5105 with 4 M of edge detection... Help!

    Dear collegaues!

    Please help me to improve my request, exhibit attached and sorry for my English.

    So my task is to extract and save all the channels (eight) of the PXI-5105 with 4 M of detection of peaks and sample rate 4 M with loop 1 sec...

    Entered all my channels are wiring detectors NaI with 0, 5... 1 microsec pulse (really) width and 0 kHz at not more than 40 kHz freq.

    Why I chose the registration of 4 M and the sampling frequency of 4 M namely? Answer is that I tested previously PXI-5105 40 kHz generator and pulse width 0.5 microsec. It works great and detection of peaks indicate 40000 pulses/s for me. If I set lower than 4M record and sample rate of 4 M, it is without work. In my honest opinion record 4 M and the frequency of sampling of 4 M are parameters very min.

    In the detection of peaks time present only 6 working channels... When I connected to diagram more 6 "detector.vi peak" - I see the error "...". out of memory... ».

    Advise me please, what needs to be done to it, it's all working well.


  • Problem with the number of lines in the channel

    Dear community LabView,

    I'm relatively new to labview and I came across a problem that (I assume) can easily be resolved with your help.

    I need to create a digital signal to trigger a camera, but I have a problem with the configuration of my lines or exit lanes. I would not use that line output to trigger the camera. (I use a card NI PCIe-6353). LabVIEW is telling me that the number of lines in the channel does not have the number of rows of data:

    Possible reasons:

    Specified read or write operation failed because the number of rows in the data of a string is not the lines in the channel.

    If you use the digital waveform data type, make sure that the number of lines in the digital waveforms is the number of lines in the channel. If you are using Boolean data, make sure that the dimension of the array for the rows of the data is the number of lines in the channel.

    Number of lines in the channel: 1
    Number of data lines: 2

    Task name: _unnamedTask<11>

    How and why the number of data rows is connected to the resolution of my analog digital converter?

    I would appreciate your help! Labview code and a screenshot attached.

    Thank you

    Beff

    I got it to work by changing the "data format" "binary not signed" OR by plugging is not the "offset" for the Square Wave VI.  I think that the default "offset binary" data format works correctly if there is a negative value.

  • Duplicate the physical channel with virtual channel

    I accidentally created more global virtual channel with a single physical channel, for example:

    global virtual channel physical channel

    A0 vtc00

    A0 vtc01

    A0 vtc02

    My questions are:

    1. How can I change the virtual channel as follows:

    global virtual channel physical channel

    A0 vtc00

    A1 vtc01

    A2 vtc02

    2-How do I re-name/remove the virtual global channel, when it is not in the task?

    Thanks for your time, Dylan

    Hello Carisa,.

    I decided to go head re - install the DAQmx tonight and re-imported the right config file known about it.  So far, all global virtual channels are now under the management of devices and interfaces plus all unwanted virtual channels have disappeared - Yippee!  I tried to browse a unit test to make sure that the virtual channels work too, they seem good.

    Finally, the issue is resolved.  I would like to say thank you to you for you and Roberto Bozozlo have spent the time to help me through this.

    Sincerely, Dylan

  • Impossible to read 4 channels with the or 9234

    Hey, I'm tasting 4 simultaneous channels to 51.2 kech / s rate for each channel with the NI 9234 module.
    I use a callback function to read from the buffer.
    I am accept to get to playback 4 channels of 51.2 k * 4 = 204.8 k s/s.
    and I still recive data 51.2 kech / s.

    Need help, I don't know what's wrong with my code.

    I enclose my hope of code it will help...

    Thank you!

    My installation information:
    Material: NEITHER 9234
    Version of Windows: XP
    Language: Qt (C++)

    Hey simon27,

    When you have installed DAQmx, did you also install text code support? There are several examples that should have installed with DAQmx which is very helpful in getting you started. "" "" "They can be found by going to your Start menu, then all programs" National Instruments "NOR-DAQ" NOR-DAQ "support textual Code ' ANSI C examples.

    In case you do not installed the supported text based code, I have attached two examples which I think would be more useful to you. Try to run these examples and see if you get the same errors.

    -Nathan H

  • I want to put a system with 10 DVD movies permanently connected to 10 TV. I want to be able to watch one of the movies playing on these brackets, simply change the channels on the TV

    I am trying to open a business and I want to be able to establish a system where I can stream movies from the DVD of 10 or more to 10 or more different TVs, just change channels with the remote control of the tv only. Is this possible. Or maybe a computer software might do the trick.

    Try sortiesdvd.com for this type of question.
     
     
    Barb
     
    MVP - Windows/entertainment and connected home
     
     
    Please mark as answer if that answers your question
     
     
     
     

Maybe you are looking for