DOUBLE cannot convert the input expression into double array

Click For Summary
SUMMARY

The discussion addresses the error encountered when attempting to convert symbolic expressions to double arrays in MATLAB, specifically when using the DOUBLE function on a symbolic array A defined as A=18*1*18. Users reported receiving an error indicating that the input expression cannot be converted. The recommended solution involves using the VPA function for symbolic variables or the SUBS function to substitute symbolic values into numerical variables. These methods provide effective workarounds for handling symbolic data in MATLAB.

PREREQUISITES
  • Understanding of MATLAB symbolic arrays
  • Familiarity with the DOUBLE function in MATLAB
  • Knowledge of the VPA function for variable precision arithmetic
  • Basic usage of the SUBS function for substituting symbolic variables
NEXT STEPS
  • Research the implementation of the VPA function in MATLAB for handling symbolic expressions
  • Explore the SUBS function documentation to understand its application in symbolic computation
  • Learn about error handling in MATLAB, particularly with symbolic variables
  • Investigate best practices for converting symbolic data to numerical formats in MATLAB
USEFUL FOR

This discussion is beneficial for MATLAB users, particularly those working with symbolic mathematics, engineers, and researchers needing to manipulate symbolic expressions and convert them to numerical formats.

bugatti79
Messages
786
Reaction score
4
Hi Folks,

I have a symbolic A=18*1*18 array containing symbols/expressions. I want to populate certain entries of this array into another matrix. For example

K(1,1)=A(1,1,1)

I get the following

? The following error occurred converting from sym to double:
Error using ==> mupadmex
Error in MuPAD command: DOUBLE cannot convert the input expression into a double array.

If the input expression contains a symbolic variable, use the VPA function instead.

I have tried
K(1,1)=vpa(A(1,1,1)) and other forms but no luck
Is there a workaround?
Thanks
 
Physics news on Phys.org

Similar threads

Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
6K
Replies
1
Views
3K
Replies
8
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
6K
Replies
5
Views
2K
  • · Replies 7 ·
Replies
7
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K