Code covered by the BSD License  

Highlights from
sym2str

5.0

5.0 | 3 ratings Rate this file 7 Downloads (last 30 days) File Size: 1.88 KB File ID: #19217

sym2str

by Martin Lawson

 

14 Mar 2008 (Updated 03 Feb 2009)

Converts symbolic variables to matlab strings using array opperations.

| Watch this File

File Information
Description

Converts symbolic variables to a Matlab equation string insuring that only array opps are used. Symbolic arrays are converted to linear Cell arrays of strings. This function is most often used to prepare symbolic answers for use with the "eval()" command. Also, converts Maple "atan" function to Matlab "atan2". Converts
Maple "array([[a,b],[c,d]])" notation to matlab "[a,b;c,d]" notation.

Note: eval() of a matrix only works if all the input variables have single values. i.e. vectors and arrays won't work.

Note2: eval() does not work on Cell arrays directly. Use "Cell_array{index}" to keep eval() happy

Required Products Symbolic Math Toolbox
MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
04 Feb 2009 Husam Aldahiyat

Great code, but the example is a bit weird.

17 Aug 2009 Georg Stillfried  
21 Nov 2010 jespestana Pestana Puerta  
21 Nov 2010 jespestana Pestana Puerta

Thank you very much!!

Please login to add a comment or rating.
Updates
31 Mar 2008

A bone headed copy-paste error causes improper results when processing symbolic arrays. ('i' and '1' are hard to tell apart :P )

03 Feb 2009

Added a code example to the help.

Tag Activity for this File
Tag Applied By Date/Time
symbolic math Martin Lawson 22 Oct 2008 09:53:34
symbolic variables Martin Lawson 22 Oct 2008 09:53:34
mathematics Martin Lawson 22 Oct 2008 09:53:34
array operations Martin Lawson 22 Oct 2008 09:53:34

Contact us at files@mathworks.com