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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

This value must be a scalar or matrix

JW_9781974
6-Contributor

This value must be a scalar or matrix

I am getting error this should be scalar or matrix as I am trying to evaluate it with a number 

1 ACCEPTED SOLUTION

Accepted Solutions


@JW_9781974 wrote:

I am getting error this should be scalar or matrix as I am trying to evaluate it with a number 


No, you don't! You are trying to multiply a string, a text (variable a) by a number (2). This can't work.
You can tell that variable a is a string by the double quotes you get when you evaluate it via a=...

There is a function to convert a string into a number (str2num()), but you would first get rid of the currency sign ($).

 

EDIT: I played around with your sheet and found something confusing. I have to say that I opened your sheet in Prime 6 which is an older version than yours but I am not sure if that is responsible for the strange effect:

When I open your sheet I see this:

Werner_E_0-1675804895622.png

This is the situation which you saw when you saved the sheet. a and TP are returned as strings - because of the $ character I guessed at first, but I am not sure about that anymore.:
When I simply let the sheet recalculate (F9 or F5) the display suddenly changes to

Werner_E_1-1675804986258.png

TP and a are now just scalars, numbers and of course you can do calculations with them.

Excel now shows a comma to separate the whole and fraction part of the numbers because thats the way my windows is setup to and Excel by default uses this setting.

 

Have you created the sheet yourself or was it just given to you by someone else? Have you tried to recalculate the sheet?

 

For completeness sake: I am using Prime 6, Windows 10 German (hence the comma instead of the dot) and an older local (not 365) Excel 2016.

 

P.S.: I am also wondering why these simple calculations are handed over to Excel as they sure could be done as well directly in Prime without using a slow reacting embedded Excel component.

 

View solution in original post

1 REPLY 1


@JW_9781974 wrote:

I am getting error this should be scalar or matrix as I am trying to evaluate it with a number 


No, you don't! You are trying to multiply a string, a text (variable a) by a number (2). This can't work.
You can tell that variable a is a string by the double quotes you get when you evaluate it via a=...

There is a function to convert a string into a number (str2num()), but you would first get rid of the currency sign ($).

 

EDIT: I played around with your sheet and found something confusing. I have to say that I opened your sheet in Prime 6 which is an older version than yours but I am not sure if that is responsible for the strange effect:

When I open your sheet I see this:

Werner_E_0-1675804895622.png

This is the situation which you saw when you saved the sheet. a and TP are returned as strings - because of the $ character I guessed at first, but I am not sure about that anymore.:
When I simply let the sheet recalculate (F9 or F5) the display suddenly changes to

Werner_E_1-1675804986258.png

TP and a are now just scalars, numbers and of course you can do calculations with them.

Excel now shows a comma to separate the whole and fraction part of the numbers because thats the way my windows is setup to and Excel by default uses this setting.

 

Have you created the sheet yourself or was it just given to you by someone else? Have you tried to recalculate the sheet?

 

For completeness sake: I am using Prime 6, Windows 10 German (hence the comma instead of the dot) and an older local (not 365) Excel 2016.

 

P.S.: I am also wondering why these simple calculations are handed over to Excel as they sure could be done as well directly in Prime without using a slow reacting embedded Excel component.

 

Top Tags