I have to read specific lines in a .txt file and thus I am using the function textread to do so. The problem is that the lines are composed of real numbers and then textread saves it as '0.957' and not as 0.957 (no commas). Because of that, I cannot save these data into a vector. I tried to remove the commas with regexprep but it didn't work. How can I do that? This is my code (that returns an error):
clc; clear variables; close all;file=fopen('takt_times.txt','r');nlines=0;while (fgets(file) ~= -1), nlines = nlines+1;endfclose(file);C = textread('takt_times.txt', '%f','delimiter', '\n');read1=2;rowindex=1;a=zeros(40,1);i=1; while rowindex < nlines cc=C{read1}; a(i)=regexprep(cc,"'", ""); read1=read1+5; rowindex=rowindex+5; i=i+1; enda
Best Answer