- 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
why %c still skip the blank data??
조회 수: 1 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
per isakson
2012년 7월 2일
편집: per isakson
2012년 7월 3일
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.
function cac = cssm
03:05:00 .000 065.501 01** 4864 0086 0074 +19 03:06:00 .000 065.501 01** 4862 0095 0074 +19 03:07:00 R- .026 065.501 01** 4862 0105 0074 +19 03:08:00 R- .180 065.504 01** 4864 0105 0074 +19
fid = fopen( 'cssm.txt', 'r' );
cac = textscan( fid, '%8c%2c%4f%7f%4c%4u%4u%4u+%2u' ...
, 'Delimiter', ' ', 'Whitespace', '' );
fclose( fid );
end
.
--- Cont. ---
I have (in the current directory):
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.
댓글 수: 11
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import and Export에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!