I really like the compactness of composite types, I think I remember
testing speed when having parameters in composite type vs dictionary and
composite type was much faster, but maybe I did it wrong.
Anyhow, I made this function and it seems to work, I pass an array of
symbols in s thats why i use string(s).....
function makeComposite(s)
q="type param "
for i=1:length(s)
q=q*string(s[i])*"; "
end
q=q*"end"
eval(parse(q))
end
Is there some problem with creating a composite type like this dynamically
since you suggest using a dictionary instead?
On Thursday, December 17, 2015 at 4:28:32 AM UTC+1, Steven G. Johnson wrote:
>
> On Wednesday, December 16, 2015 at 10:11:20 AM UTC-5, Jon Norberg wrote:
>>
>> Is it possible to dynamically create a composite type if I have a list of
>> strings for the fieldnames?
>
>
> While this is possible, you should probably consider using a dictionary
> type rather than creating a composite type on the fly.
>