이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
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
채택된 답변
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):
- 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.
댓글 수: 11
Soni huu
2012년 7월 3일
thanks sir. how i ceck every cell.. i use cac{1} but i see this meseg
??? Undefined variable "cac" or class "cac".
per isakson
2012년 7월 3일
What have you done - step by step - to get that message?
>>clear
clc
>>perisakson % mfile name
ans =
Columns 1 through 6
[1389x8 char] [1389x2 char] [1389x1 double] [1389x1 double] [1389x4 char] [1389x1 uint32]
Columns 7 through 9
[1389x1 uint32] [1389x1 uint32] [1389x1 uint32]
>> cac{9}
??? Undefined variable "cac" or class "cac".
Soni huu
2012년 7월 3일
step 2
>> ans{1}
ans =
00:00:00
00:01:00
00:02:00
00:03:00
>> ans{2} ??? Cell contents reference from a non-cell array object.
>> ans{3} ??? Cell contents reference from a non-cell array object.
>> ans{9} ??? Cell contents reference from a non-cell array object.
%perisakson.m
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( '09-25-2010.dat', 'r' );
cac = textscan( fid, '%8c%2c%4f%7f%4c%4u%4u%4u+%2u' ...
, 'Delimiter', ' ', 'Whitespace', '' );
fclose( fid );
end
Walter Roberson
2012년 7월 3일
Do not name the file perisakson.m -- name it cssm.m and invoke it by that name.
my result
>> cssm
ans =
Columns 1 through 3
[1389x8 char] [1389x2 char] [1389x1 double]
Columns 4 through 6
[1389x1 double] [1389x4 char] [1389x1 uint32]
Columns 7 through 8
[1389x1 uint32] [1389x1 uint32]
Column 9
[1389x1 uint32]
>> ans{1}
ans =
00:00:00 00:01:00 00:02:00 etc
>> ans{2} ??? Cell contents reference from a non-cell array object.
>> cac{2} ??? Undefined variable "cac" or class "cac".
>> cac{:2} ??? cac{:2} | Error: Missing MATLAB operator.
>> ans{1:}
??? ans{1:} | Error: Unbalanced or misused parentheses or brackets.
Walter Roberson
2012년 7월 3일
편집: Walter Roberson
2012년 7월 3일
cac = cssm;
cac{1}
cac{2}
Soni huu
2012년 7월 3일
ITS WORK...
THANKS YOU VERY MUCH
Soni huu
2012년 7월 3일
how load 30 file at one time
ex data from ( 09-1-2010.dat to 09-30-2010.dat )
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Image Acquisition Toolbox Supported Hardware에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
