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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Excel Input - This value must be scalar or matrix

davidlimtw
7-Bedrock

Excel Input - This value must be scalar or matrix

Hi All,

 

why mathcad prime dont allow to input the results of a fuction with a range of input into the excel component. What is the way to go around this?

 

davidlimtw_0-1720900925812.png

 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:davidlimtw)

There is a huge difference between ranges (like your "a") and vectors). Unfortunately they look the very same in Prime when displayed.

Your problem stems from an "illegal" use of a range variable.

Ranges should be used to

1) index the elements of vectors and matrices

2) make for-loops in programs

3) define the abscissa values in a 2D-plot

but not for anything else.

Actually a range is not a data type consisting of a couple of values like a vector but rather kind of an implicit loop.

 

What you created when you typed f(a)= looks pretty much like an ordinary vector, but actually its not a vector and its also not a range - its an invalid object. You can't even assign it to a variable - you get an error if you try so:
Werner_E_0-1720909292396.png

Its fine and OK to use your range "a" for plotting

Werner_E_1-1720909435042.png

 

For other things you rather should create and work with true vectors as shown and explained below:

Werner_E_2-1720910582875.png

 

Prime 10 sheet attached

 

View solution in original post

4 REPLIES 4
LucMeekes
23-Emerald III
(To:davidlimtw)

1. The output to Excel accepts only arrays, yours is a range.

2. The output to Excel accepts only unit less data, yours has a length dimension.

 

Success!

Luc

Werner_E
25-Diamond I
(To:LucMeekes)

@LucMeekes wrote:

1. The output to Excel accepts only arrays, yours is a range.

2. The output to Excel accepts only unit less data, yours has a length dimension.

 


Actually "a" IS a range and "a" is NOT unit less, but still "a" IS accepted by the Excel component as input! 🙂

 

The problem is f(a), which neither is a range nor an array/vector.

Werner_E
25-Diamond I
(To:davidlimtw)

There is a huge difference between ranges (like your "a") and vectors). Unfortunately they look the very same in Prime when displayed.

Your problem stems from an "illegal" use of a range variable.

Ranges should be used to

1) index the elements of vectors and matrices

2) make for-loops in programs

3) define the abscissa values in a 2D-plot

but not for anything else.

Actually a range is not a data type consisting of a couple of values like a vector but rather kind of an implicit loop.

 

What you created when you typed f(a)= looks pretty much like an ordinary vector, but actually its not a vector and its also not a range - its an invalid object. You can't even assign it to a variable - you get an error if you try so:
Werner_E_0-1720909292396.png

Its fine and OK to use your range "a" for plotting

Werner_E_1-1720909435042.png

 

For other things you rather should create and work with true vectors as shown and explained below:

Werner_E_2-1720910582875.png

 

Prime 10 sheet attached

 

Hello @davidlimtw

 

It looks like you have some responses from some community members. If any of these replies helped you solve your question please mark the appropriate reply as the Accepted Solution. 

Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.

Thanks,
Vivek N.
Community Moderation Team.

Announcements

Top Tags