How to re-produce an existing variable in the script without using it?
9 visualizzazioni (ultimi 30 giorni)
Hi, this sounds silly... I have a variable in my workspace... say it is called A of size (200,1). Each element of it is just a number, e.g. A=[3;3;444;555;...]... Now I would like to define the exact same A in the script without using the A in workspace... Of course, I can do it manually A=[3;3;444;555;...], but that takes forever. Is there a smart way that I can define A in script without having to have A in the workspace? Thanks!
Thorsten il 19 Nov 2015
You can use dlmwrite the write A to a file, open the file in an editor and copy and paste the contents to your script and add the A = [ ...]; syntax.
Stephen23 il 19 Nov 2015
Modificato: Stephen23 il 19 Nov 2015
It seems that you are looking for functionality like this FEX submission uneval:
This submission takes a variable and prints a string that when evaluated reproduces the same variable as the function was given. I do not think that the author has updated it to include tables, however you could write to them and request this, or make the required changes yourself.
Ilham Hardy il 19 Nov 2015
What do you mean by slow and not using the variable in workspace?
B = A; ?