Topic
4 replies Latest Post - ‏2013-12-01T22:42:06Z by JeanZ
CutePrince
CutePrince
3 Posts
ACCEPTED ANSWER

Pinned topic How to specify a block attribute of type array or multidimensional array in Rational Rhapsody Developer C++ or Java?

‏2013-11-28T16:29:30Z |

I do not know if any of you have implemented or specified in C++ or Java (i.e. within Rational Rhapsody) a block with an attribute of type array or multidimensional array (please see e.g. attribute called "anArray" shown below):

 

int anArray[3][5] =

{

{ 1, 2, 3, 4, 5, }, // row 0

{ 6, 7, 8, 9, 10, }, // row 1

{ 11, 12, 13, 14, 15 } // row 2

};

 

I have been experiencing some difficulties with specifying a multidimensional array attribute within Rational Rhapsody C++ Developer. Do you have any idea how this might rather be correctly specified?

 

Indeed, what looks/sounded like a trivial issue is proving difficult to implement within Rational Rhapsody!

 

Please kindly help.

Updated on 2013-11-28T16:29:59Z at 2013-11-28T16:29:59Z by CutePrince
  • JeanZ
    JeanZ
    194 Posts
    ACCEPTED ANSWER

    Re: How to specify a block attribute of type array or multidimensional array in Rational Rhapsody Developer C++ or Java?

    ‏2013-11-29T06:43:57Z  in response to CutePrince

    Hi

    You have to define the multidimentional array in Rhapsody by yourself . see attachment please.

    Hope it helps.

    Regards

    Attachments

    • CutePrince
      CutePrince
      3 Posts
      ACCEPTED ANSWER

      Re: How to specify a block attribute of type array or multidimensional array in Rational Rhapsody Developer C++ or Java?

      ‏2013-11-29T11:48:39Z  in response to JeanZ

      Hi Jeanz,

      I cannot view the sample.png file you attached as the solution to how to create multidimentional array in Rhapsody. Please can you send it to me via my personal email: eogunshile@yahoo.com?

      • CutePrince
        CutePrince
        3 Posts
        ACCEPTED ANSWER

        Re: How to specify a block attribute of type array or multidimensional array in Rational Rhapsody Developer C++ or Java?

        ‏2013-11-29T12:03:42Z  in response to CutePrince

        !. Another issue is that I do not just need to create an attribute  of type array or multidimensional array in Rational Rhapsody but I also need to be able to initialise it when it has been created.

        2. where:

        int anArray[2][5] =

        {

            { 1, 2, 3, 4, 5, }, // row 0 (this will represent the x-axis points on a 2D graph)

            { 6, 7, 8, 9, 10, }, // row 1 (this will represent the y-axis points on a 2D graph)

        };

         

        3. My goal is to use the above information to plot a 2D graph with e.g Point(x, y) within the constraint view of the Rational Rhapsody plot function using matlab as the math engine.

        Please help.

         

         

        Your help would

         

         

         

      • This reply was deleted by JeanZ 2013-12-01T22:42:33Z.
  • Yevo
    Yevo
    278 Posts
    ACCEPTED ANSWER

    Re: How to specify a block attribute of type array or multidimensional array in Rational Rhapsody Developer C++ or Java?

    ‏2013-11-30T15:59:33Z  in response to CutePrince

    Hi,

    You can define a type with appropriate multiplicity for every dimension but the first one and use this type. For example:

    typedef int row[5];

    row anArray[2];

     

    And you can , of course, fill in the Initial value field of this attribute with appropriate syntax (like in your question).

    Good luck,

    Vladimir