|
"Sam " <saurabh_biomed@yahoo.co.in> wrote in message <he3oc7$10r$1@fred.mathworks.com>...
> Hii
>
> I am stuck in a seemingly small problem.
> In a loop i am generating variables using the function genvarname.
> I want to access these variables e.g. displaying them as an image
> the simple discription is as follows
>
> for i =1:10
> var = genvarname(str);
> eval([var '=mat(1:10,1:10)']);
> imtool(var???(not working)), imashow, plot...??????
> end
>
> thnx in advance
> sam
Hi Sam,
I am not sure why you are doing this but in your codevar is a string generated by genvarname. After the eval statement there exists a new variable in the workspace with the name from var which has the value you assigned to it, but var is still just a string containing the name of the variable. If you want to use imtool on the data contained in the variable that was named by the string in var you could use:
imtool(eval(var));
or you could capture the output of your first eval:
temp = eval([var '=mat(1:10,1:10)']);
imtool(temp);
Hope this helps,
Donn
|