I have a workspace with a bunch of variables I'd like to turn into a JSON document using JSONlab. My code so far looks like this:
loadjason = {'{"Duration":Duration,"Num_Samples":nsamples,"Frequency":Freq,"Num_Channels":nchannels1}')
The items not in double quotes (i.e. Freq) are variables from my MATLAB workspace but my output is:
Error using loadjson>error_pos (line 482)
JSONparser:invalidFormat: Value expected at position 13:
{"Duration":<error>Duration,"Num_Samples
Error in loadjson>parse_value (line 471)
error_pos('Value expected at position %d');
Error in loadjson>parse_object (line 206)
val = parse_value(varargin{:});
Error in loadjson (line 96)
data{jsoncount} = parse_object(opt);`
How do I pass variables into loadjson so that they are read as their values and not as literals?