cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.

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

ddenholm
6-Contributor

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

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!

ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

2 REPLIES 2

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.

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

Announcements

Top Tags