comparison m-toolbox/classes/+utils/@prog/mup2mat.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % MUP2MAT converts Mupad string to MATLAB string
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: MUP2MAT converts:
5 % MUP2MAT converts the Mupad string r containing
6 % matrix, vector, or array to a valid MATLAB string.
7 %
8 % NOTE: Copied from the Symbolic Toolbox function sym/matlabFunction
9 %
10 % VERSION: $Id: mup2mat.m,v 1.1 2009/05/25 14:14:08 mauro Exp $
11 %
12 % HISTORY: 21-05-2009 M Hueller & L Ferraioli
13 % Creation
14 %
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16
17 function r = mup2mat(r)
18
19 r = strtrim(char(r));
20 % Special case of the empty matrix or vector
21 if strcmp(r,'vector([])') || strcmp(r,'matrix([])') || ...
22 strcmp(r,'array([])')
23 r = '[]';
24 else
25 % Remove matrix, vector, or array from the string.
26 r = strrep(r,'matrix([[','['); r = strrep(r,'array([[','[');
27 r = strrep(r,'vector([','['); r = strrep(r,'],[',';');
28 r = strrep(r,']])',']'); r = strrep(r,'])',']');
29 end
30 end