SmithLabNeuro / Ex

Experimental Software
8 stars 1 forks source link

If a slash is incorporated into the params in the XML function, it causes issues #7

Open mattslab opened 1 year ago

mattslab commented 1 year ago

Describe the bug

Quick summary: You can incorporate slashes into the XML file, and then ex can handle them and evaluate them as a Matlab function, but then when the variables are sent out as digital codes, it can change the meaning a bit. Need to be really careful about how slashes are handled in XML files, as Pati seemed to find a creative way to use them that could be tricky for reconstructing from the NEV information. Email text below.


In an ex function, code like this:

morphs = cellfun(@str2num,regexp(e.CmorphAngle,'/','split'),'UniformOutput',0);

handled this parameter in the XML file:

'4,10,50,100,190/ 1,4,15,50,70/ 4,8,30,50,70/ 2,4,15,40,50/ 4,8,30,100,190/ 4,8,30,50,70/ 5,10,10,30,50/ 55,40,10,5,1/ 4,8,50,80,100'

But, in the sending of codes to the NEV file, the quotes are dropped and so it gets evaluated as a math expression (190 divided by 1).

Basically, the use of quotes in the XML gets the data sent as a string into the ex function, but then once it's in the ex function it is a set of numbers, so when it is sent back out as digital codes you can't quite reconstruct the original meaning. They could be reconstructed by specific knowledge of the XML file and how things were sent in, but that defeats the general purpose framework of the XML files. This creates a problem for "getDatParams" in the nevutils repo.

A potential answer is to prohibit this behavior in some way at the front end (when XML files are read in). Or, we need to figure out a clever way to send things to the digital codes, or read them back in from the digital codes, to make sure info isn't lost.