Copy signals to data matrix

SupportCommunity Automation and VBA Copy signals to data matrix

Ansicht von 8 Beiträgen - 1 bis 8 (von insgesamt 8)
  • Autor
    Beiträge
  • #12426

    I need to perform some matrix manipulations on the data of 4 signals. To do this I need to copy the contents of the signals in a matrix.

    The signal (‘1’) has the following form:
    Signal with 24,000 64-bit floating points

    The matrix (‘DataMatrix’) has the folowing form:
    Data matrix with 4 data series with 24,000 64-bit floating point values each

    I copy the data using:
    ActiveDatabase.RootFolder.Object(“DataMatrix”).FillColumns “‘1′”, fpDataComponentY, , , 1, 1

    This produces the error:

    A change of values is not possible. The following error has occured: wrong data type. The process has been canceled

    If try to copy the number 1 to the matrix using FillColumns “1” then there is no problem.

    How should I copy the signals to the data matrix?

    #8107

    I need to perform some matrix manipulations on the data of 4 signals. To do this I need to copy the contents of the signals in a matrix.

    The signal (‘1’) has the following form:
    Signal with 24,000 64-bit floating points

    The matrix (‘DataMatrix’) has the folowing form:
    Data matrix with 4 data series with 24,000 64-bit floating point values each

    I copy the data using:
    ActiveDatabase.RootFolder.Object(“DataMatrix”).FillColumns “‘1′”, fpDataComponentY, , , 1, 1

    This produces the error:

    A change of values is not possible. The following error has occured: wrong data type. The process has been canceled

    If try to copy the number 1 to the matrix using FillColumns “1” then there is no problem.

    How should I copy the signals to the data matrix?

    #8704
    Bernhard KantzBernhard Kantz
    Moderator

    Unfortunately we can’t reproduce your problem. Your code works with the latest version of FlexPro.
    Please download the latest version and try it again.

    Support@weisang.com

    #8705

    I’ve downloaded and installed the 30 day evaluation version.
    I removed version 6 from my pc first. Is it possible to have both versions installed at the same time?
    After opening my project in version 7, I got the message as indicated in the attached picture. Does this problem only occur in the evaluation version, or would I also have this problem in the professional version?
    After this error message, Flexpro crashed with an exeption access violation.

    Is an alternative method available in version 6 to load the signals in the matrix?

    #8706
    Bernhard KantzBernhard Kantz
    Moderator

    You can install both FlexPro6 and FlexPro7 at the same time.
    But you can only open FlexPro Demo Databases with the demo version which are not older than 30 days. This is a limitation of the demo version. With FlexPro 7 Standard or Professional you can open FlexPro6 databases.

    Your code also works with FlexPro 6.0.35.

    Is an alternative method available in version 6 to load the signals in the matrix?
    You could create a FPScript formula to calculate the new matrix:
    [CODE]
    Dim d
    d = DataMatrix
    d[0] = ‘1’
    return d
    [/CODE]

    support@weisang.com

    #8707

    I have created a small Flexpro file that includes a VBA programme to fill a data matrix using the ‘FillColumn’ statement. I have used in version 6.0.35 and version 7 and also using version 6.0.33 on a different machine. All versions crashed the same way as described previously. (computer is Compaq Evo P4 2.4 GHz and XP Professional SP2)

    The file also includes a formula that tries to fill the matrix using a FPScript. I have tried to fill ‘DataMatrix’ (Signal series with 4 signals) and ‘DataMatrix2’ (Data matrix with 4 data series). They both crash (in version 6.0.35 and 7) with the message ‘Signals cannot be used on the right side of an indexed assignment. Assign the components seperately.’

    I solve this by recording a macro whilest filling the matrix by hand. However, this option would be too slow to implement in the programme.
    Please advise how to solve this problem!!

    #8708
    Bernhard KantzBernhard Kantz
    Moderator

    If you want to copy the values of a signal into a signal series you have to copy the components of the signal seperately.

    Copy the y-values of the signal into the first column of the signal series:
    [CODE]
    Dim oDataset As DataSet
    Set oDataset = ActiveDatabase.RootFolder.Object(“DataMatrix”, fpObjectTypeDataSet)
    oDataset.FillColumns “‘1’.y”, fpDataComponentY, , , 1, 1
    oDataset.FillColumns “‘1’.x”, fpDataComponentX, , , 1, 1
    [/CODE]
    The equivalent FPScript formula is:
    [CODE]
    Dim d
    d = DataMatrix
    d.y[0] = ‘1’.y //Copy y-values
    d.x = ‘1’.x //Copy x-values
    return d
    [/CODE]

    Support@weisang.com

    #8709

    Thank you very much! It works perfect now.

Ansicht von 8 Beiträgen - 1 bis 8 (von insgesamt 8)
  • Du musst angemeldet sein, um auf dieses Thema antworten zu können.