Skip to main content
1-Visitor
February 22, 2017
Solved

How to convert a row of Excel cell values to a useful MCP vector?

  • February 22, 2017
  • 1 reply
  • 1382 views

Sorry if I am being a bit dense with this...

I created a table of values in the MCP 3 Excel component.

In the Outputs area, I set a variable ("Load") equal to a row of cells using an Output Expression multiplied by a unit (MW).

Outside of the Excel component, I evaluate Load and I get, for example, the following:

Load = [5.2 3.2 3.2 3.2 3.9] MW

I have a few questions about this...

One, when I looked at some YouTube tutoriials for the Excel component in which something very similar was done, the result of the evaluation was a vertical column of numbers rather than the horizontal row I get. Why is my evaluated result horizontal when the tutorial result is vertical?

Second, what is this variable in MCP terms? Is it a vector or a range variable?

Third, how do I use my variable. For example, if I wanted to set a variable, say, Load_3 to be equal to the 5th value in my vector (3.9), what would the syntax be? "x=Load(4)" does not work since my variable does not seem to be a vector or matrix (is it a range variable?)

Fourth, can I convert my Load variable to actually be a vector so I can use it in calculations?

Finally, if there are any tutorials or examples available for this area, please direct me to them.

Thanks!

Best answer by Fred_Kohlhepp

I suspect that you defined a row of EXCEL as an input, so Mathcad declared a row array.

Try transposing your Load variable, you should get a vector.

1 reply

23-Emerald I
February 22, 2017

I suspect that you defined a row of EXCEL as an input, so Mathcad declared a row array.

Try transposing your Load variable, you should get a vector.

ddenholm1-VisitorAuthor
1-Visitor
February 22, 2017

Thanks... That was helpful...

I am a little bemused as to why a column of 5 excel cells is a vector but a row of 5 excel cells is an array but in MCP that is obviously the case (once you pointed it out to me. )

If I reference Load(0,3), I can access the value I want.

I have some more questions about how to use the Excel component but you have answered this post, so I will post my other questions separately.

Thanks again,

--Doug