🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Dynamically accessing the corresponding variables

User: "Shubha"
New Altair Community Member
Updated by Jocelyn
Hi,

I have an exampleset,

A B C D Var_A Var_B Var_C Var_D
23 45 67 89 5 5 5 4
23 45 12 76 6 4 6 3
23 45 67 78 7 3 7 2
87 54 32 23 3 2 8 1

As you see there are four A, B, C, D variables and their corresponding Var_A, Var_B, Var_C, Var_D variables. Now, I need four other columns giving the differences. (say (A-Var_A)...). The result should be:

Diff_A Diff_B Diff_C Diff_D
18 40 62 85
17 41 6 73
16 42 60 76
84 52 24 22

I attach the datafile, data.txt. And the case could be, I will have A, B, C, D, E,F...... variables

[attachment deleted by admin]

Find more posts tagged with

Sort by:
1 - 4 of 41
    User: "TobiasMalbrecht"
    New Altair Community Member
    Hi,

    you could use the [tt]AttributeConstruction[/tt] operator to calculate the differences. You could also combine this operator with a [tt]FeatureIterator[/tt] to automatically iterate over attributes and calculate the differences.

    Kind regards,
    Tobias
    User: "Shubha"
    New Altair Community Member
    OP
    Thanks Tobias,

    I quick question... It seems that i should use two "FeatureIterator" operators (one for A, B, C, D) and the other for 'Var' variables. Am I correct?

    Thanks, Shubha
    User: "TobiasMalbrecht"
    New Altair Community Member
    Hi Shubha,

    no, just use one [tt]FeatureIterator[/tt] and set the attribute regex accordingly. In the [tt]AttributeConstruction[/tt] use the loop macro and generate the difference expressions using that macro.

    Regards,
    Tobias
    User: "Shubha"
    New Altair Community Member
    OP
    Thank you very much... It worked...