What I am trying to do is write a script in Matlab that will parse some HTML, get some data out of it, take this data, and then format it into a Javascript string array. I do not have a problem grabbing HTML and parsing it and so forth, I am having trouble trying to print a string using sprintf that will contain a backslash.
Basically if you have a string in Javascript that contains a quotation mark you need to escape it with a backslash:
var string1 = "Here is a \"string\" example"; When I try to do this in Matlab as follows, it does not print correctly:
>> A = sprintf('Here is a \"string\" example') A = Here is a "string" example This is not a valid Javascript string. So basically I want sprintf to return a proper Javascript string; any suggestions?
I have tried using \\" and \\\" and a few similar combinations, all to no avail.