El martes, 3 de noviembre de 2015, 10:27:27 (UTC-6), Dawid Crivelli escribió: > > How about using a dictionary instead of variables, to do something like > the following: > > images = Dict{AbstractString, Image}() # dictionary associating an > Image object to a string > image["flower"] = imread("flower.png") # made up function name > > Accessing the dictionary won't significantly slow the access to the image > data stored in memory, and you can access the images by their reference > string, which can depend on input data (e.g. a list of files). >
Using a dictionary is a nice solution, but usually you want the types used for the keys and values to be concrete types, not abstract: images = Dict{UTF8String, Image}()