Skip to main content
1-Visitor
September 20, 2018
Solved

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

  • September 20, 2018
  • 2 replies
  • 6642 views

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.

This topic has been closed for replies.
Best answer by Werner_E

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.

2 replies

23-Emerald IV
September 20, 2018

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

 

yudi1-VisitorAuthor
1-Visitor
September 21, 2018

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

Werner_E25-Diamond IAnswer
25-Diamond I
September 20, 2018

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.

yudi1-VisitorAuthor
1-Visitor
September 21, 2018

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

25-Diamond I
September 21, 2018

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