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 called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Warning: These array elements must be scalar. They cannot be vectors or matrices

yudi
3-Visitor

Warning: These array elements must be scalar. They cannot be vectors or matrices

Hallo Everybody,

 

My name is Yudi. I am a student and I newbie using Mathcad Prime software. I have a problem so I hope somebody can give me a solution. I using this software for analysis RC beam and after I get the result, I compare with experiment data. The problem is I can not transfer the result in the plot because there is a warning "These array elements must be scalar. They cannot be vectors or matrices". I have searching in other reference and I try to apply the method but the warning still appears.

ACCEPTED SOLUTION

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

Two problems in your sheet:

 

1) in one place you used a square bracket instead of a pair of parentheses. Square brackets create a vector/matrix. Thats the reason Ft and Mt are vectors consisting of 1x1 matrices

 

2) At the end you should not return the calculated vectors by putting them into a 1x5 vector as this creates a nested vectors structure and you would have to use D[0,2 to get the vector Ft.

It seems to be cleaner to create just a big matrix using augment. That way you can access the vectors the same way you tried anyway.

 

B.png

Worksheet in Prime 5 format attached.

View solution in original post

5 REPLIES 5
LucMeekes
23-Emerald III
(To:yudi)

The output of your program ( D:=...  ) is a row-array containing vectors as elements.

You assign the first element to epsilon.0, and it becomes a vector (=column-array) of 1 element {due to the way you pick it out of D}. That one element is a vector with 31 elements. Had you assigned epsilon.0:=D[0,0 it would have become a simple vector.

You are trying to plot M.t, take as is the fourth element of D, and (again due to the way you picked it out of D) is a (1 element) vector, containing a 31-element vector, that contains one value of 0 and the remaining 30? elements are each 1-element vectors.

Your Phi has similar problems.

Mathcad  (and Prime is no better, nor worse than that) can ONLY plot vectors and scalars (not vectors containing vectors containing...).

You'll have to restructure your program, to assure that (ideally) D contains only 5 vectors, or that all data is contained in a single matrix.

 

Success!
Luc

 

yudi
3-Visitor
(To:LucMeekes)

Thank you for your suggestion. I will try to modification my program again.

Werner_E
25-Diamond I
(To:yudi)

Two problems in your sheet:

 

1) in one place you used a square bracket instead of a pair of parentheses. Square brackets create a vector/matrix. Thats the reason Ft and Mt are vectors consisting of 1x1 matrices

 

2) At the end you should not return the calculated vectors by putting them into a 1x5 vector as this creates a nested vectors structure and you would have to use D[0,2 to get the vector Ft.

It seems to be cleaner to create just a big matrix using augment. That way you can access the vectors the same way you tried anyway.

 

B.png

Worksheet in Prime 5 format attached.

yudi
3-Visitor
(To:Werner_E)

Thank you very much Mr. Werner_E for your solution. It's working. I just know function of "Augment". Once again thank you very much.

Capture.JPG

Werner_E
25-Diamond I
(To:yudi)

You are welcome.

I think its a better and more versatile way for the function to return the row vector of result vectors as you did it in the first place instead of the matrix created by augment as I suggested.
Its quite easy to separate the five vectors as you can see in the picture and you even can omit the variable D completely if you write  [e c Ft Mt phi] in front of the program instead of D if you like.

B.png

Announcements

Top Tags