i have data in .dat file, in column 2 the data show as R- R+ and blank data (2 space). i use %c to chose the blank data, but %C still skip the blank data.
nb: i use matlab7 14
Best Answer
I assume this question concern the same data file as your previous question. This function reads a data file, which contains the four rows, which I have comment out below.
an m-file named, cssm.m, as shown above (function and file must have the same name). The Code Analyzer box at the top left of the editor pane is green.
a data file named cssm.txt, which contains your four lines. The same four lines are shown as comments in the function
I do:
>> cac=cssm();
>> cac{1}
ans =
03:05:00
03:06:00
03:07:00
03:08:00
>> cac{2}
ans =
R-
R-
>> cac{9}
ans =
19
19
19
19
cac{2} contains four rows, the two first of which contains " ". However, Answer doesn't show blank lines.
You can use textscan(), and at the place where you might have the R- or might not, use %2c as the format. %c doesnot skip blanks. (Experiment: there is a chance you might need to use %*c%2c instead, to eat the space between fields.)
Best Answer