I'm trying to read a .log file and get information that will later be used to create a graph.
%Open text file
fileID = fopen('file.log');
text = textscan(fileID, '%s', 'delimiter','\n','whitespace','');
json_text=cellfun(@(x) x(53:end-1),text, 'UniformOutput',false);
%Decode in json
data=cellfun(@jsondecode,json_text,'UniformOutput',false);
I'm getting the following error:
Error using jsondecode JSON text must be a character vector or a scalar non-missing string.
To me, it seemed like a straightforward problem to solve, but I tried googleing it and I can't find any solution.
I have tested if the first three commands are working (e.g. without decoding to json part) and it works. So the problem is when I try to decode the data to json.
Any hints what the problem could be?
Below is a sample line from the .log file:
123456.99 :: working completed: result=0 , data ="{"day":"monday", "breakfast":"sandwich"}"