
As an alternative to the Visual Basic version, this tool can convert a matrix which is written in a normal matrix style (rows separated by new line and columns separated by spaces) to the Wolfram|Alpha style with curly-brackets.
function convert(input){
input = input.split(/\n/); //Split lines
var r = "";
for(var i = 0; i < input.length; i++){
if(i != 0){r += ",";}
r += "{" + input[i].trim().replace(/ /g, ',') + "}";
}
if(input.length > 0){r ="{" + r + "}"};
return(r);
}
Leave a Reply