Search code examples
csvmatrixreplacescilab

Scilab how to replace a comma with a dot in an matrix


May I ask for some advice, please? I have for homework process data from file which has this structure:

"Time;Track;Force s;mm;N 0,020;0,253;0,060 0,040;0,320;0,030 0,060;0,387;0,060 0,080;0,453;0,060 0,100;0,520;-0,000 0,120;0,587;0,030 0,140;0,654;0,030 0,160;0,721;-0,000 0,180;0,787;0,030 0,200;0,854;0,030 0,220;0,921;0,030 0,240;0,988;-0,000"

To load the data to matrix I use this command: csvRead("Pene_1.txt",[';'],[],"string") However my issue with this, is that the dates I would need in double because I will need to do some calculate with them, but in Europe a decimal point is used as the data separator instead of a decimal point. I would need to replace all of these decimal commas with decimal dots throughout the matrix. Please does anyone how to do it? Thanks you very much :) by the way there I put whole file :) http://leteckaposta.cz/859703762


Solution

  • Use csvRead("Pene_1.txt",';',',',"string") the third parameter ',' defines the decimal separator.