Watch this Author's files
Good script. I would suggest changing your variable 'length' to a different name, as matlab has a built-in function, length, and it is no longer able to be used if you override it with a variable. But other than that, nice job!
And Andras is right... This is much easier to do:
And thats it. Call in command window by Ulam_Spiral(n) where n is the size of the matrix.
I have just downloaded your code and it seems to be receiving great reviews. I can't seem to get it to work though... All i want to do is to save a figure window to my desktop.
I have a figure that is displaying an image. How would I use export_fig to save this figure under the name 'test' in png format?
This is what I am seeing: (H is set to be the figure handle)
Error using print
Too many input arguments.
Error in print2array (line 140)
print(fig, renderer, res_str, '-dtiff', tmp_nam);
Error in export_fig (line 334)
[A, tcol] = print2array(fig, magnify, renderer);