Multiline Statement To Build A Const Array


Recommended Posts

Hello,

 

i need to write down a vector channel to logical channel map,

 

i try:

// this map allows creation of logical-address vector from hardware-address vector.
// usage: for LogicIdx : temps_logic[LogicIdx]=hardware_temps[HardwareChannelIdxToLogicalChannelIdxMap[LogicIdx]]

global HardwareChannelIdxToLogicalChannelIdxMap =
{  NaN(),                                          // 0 - no correspondence
   0*9+1,   0*9+2,   2*9+1,   3*9+1,   3*9+9,      // T1,T2,T3,T4,T5
   3*9+7,   3*9+2,   2*9+2,   0*9+3,   0*9+4,      // T6,T7,T8,T9,T10
   }

This will not compile because i am writing a statement that is longer than 1 line . . . .

 

is there a way of writting in more than 1 line, or maybe i should use a different method?

 

 

Link to comment
Share on other sites

Use backslash to separate lines.  But it also won't compile because you can't put NaN() or any non-constants inside {}.  Also, you have a widowed comma.  You might consider using Append instead:

 

global myChan

myChan.append(NaN())

myChan.append({*9+1,   *9+2,   2*9+1,   3*9+1,   3*9+9})

myChan.append({3*9+7,   3*9+2,   2*9+2,   *9+3,   *9+4})

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.