Array Access in Symbolic Calculations

2 visualizzazioni (ultimi 30 giorni)
Nicholas Dinsmore
Nicholas Dinsmore il 8 Mar 2013
I am using the symbolic math toolbox to turn an ugly recursive algorithm that accesses and array into a matlab function. Everything is working but I keep getting a warning message that makes me think I am declaring the array as a function which I think is a bit hacky. I am hoping someone can point me to a better method.
Here is how I am doing it:
i=sym('i');
assume(i,'integer');
ArrayVar= symfun(sym('ArrayVar(i)'), [i]);
...%inset recursive Algorithm here
matlabFunction(RecursiveResult,'file','FlattenedAlgorithm.m','vars',{'index','ArrayVar'});
Like I said that works but when I run it I get a warning message that I am hoping with better representation of the array I could avoid. The warning message is "Warning: Function "ArrayVar" is not verified to be a valid MATLAB function.". I could just suppress the message but before I do that I wanted to make sure there wasn't a better way to access the array without pretending it is a function.

Risposte (0)

Categorie

Scopri di più su Symbolic Math Toolbox in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by