열 이름 없이 데이터 테이블을 TXT에 어떻게 저장합니까?여러분, 안녕하세요:
열 이름 없이 TXT에 데이터 테이블을 어떻게 저장합니까?감사합니다!
Re: 열 이름 없이 데이터 테이블을 TXT에 어떻게 저장합니까?여보세요,
텍스트 파일에서 특정 문자열 체인을 별도의 줄에 저장해야 하므로 위의 txnelson 일대일 솔루션을 시도했지만 파일을 반환하지만 문자열 체인은 한 줄에 저장되었습니다. 내 경우에는 개행 문자가 원하는 효과를 가져오지 않는 것 같습니다. 내가 무엇을 놓치고 있습니까?
친애하는
편집하다:
좋아, 대신 "\!N" 나는 썼다 "\!r\!n" 그런 다음 원하는대로 작업했습니다.
Re: 열 이름 없이 데이터 테이블을 TXT에 어떻게 저장합니까?걸작입니다. 매우 감사합니다!Re: 열 이름 없이 데이터 테이블을 TXT에 어떻게 저장합니까?대안은 내보내기 기본 설정을 변경하고 파일을 저장한 다음 기본 기본 설정으로 돌아가는 것입니다.
아래 스크립트에는 단계가 포함되어 있습니다. JSL Companion, 2nd Ed에 문서화되어 있습니다. 스크립트 2_Extra_SaveText.jsl
Names Default to Here(1);
//Get a copy of the user's settings
_xx = Get Preference( Export settings);
//set the text export preferences you want
Preference(
Export Settings(
End Of Line( CRLF ),
End Of Field( Comma, CSV( 1 ) ),
Export Table Headers( 0 ),
Quote all column names( 0 ),
Quote all character values( 0 ),
Quote all numeric values( 0 )
)
);
//you can look at preferences now an they will be changed.
dt = Open("$Sample_data/Big Class.jmp");
dt << Save("c:/temp/bclass.txt");
//reset the user's preferences
_xx;Re: 열 이름 없이 데이터 테이블을 TXT에 어떻게 저장합니까?나에게도 이에 대한 해결책이 필요했다. 솔루션 txnelson에 감사드립니다.
Re: 열 이름 없이 데이터 테이블을 TXT에 어떻게 저장합니까?고마워요!
이렇게 순환할 것입니다. VBA에서도 마찬가지입니다.Re: 열 이름 없이 데이터 테이블을 TXT에 어떻게 저장합니까?다음은 원하는 작업을 수행하는 간단한 스크립트입니다.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
// Loop across all rows
For( i = 1, i <= N Rows( dt ), i++,
// Copy all columns for the given row into a list
rowVals = dt[i, 0];
// Initialize a string variable
theString = "";
// Loop across all values in the row list, and place them into the string variable
For( k = 1, k <= N Items( rowVals ), k++,
If( k > 1,
// After the first value, add a comma between the values
theString = theString || ","
);
theString = theString || char(rowVals[k]);
);
// Add a new line character at the end of the line
theString=theString||"\!n";
// Write the row's values to the output txt file
If(i==1,
save text file("$TEMP/myfile.txt",theString,mode("replace")),
save text file("$TEMP/myfile.txt",theString,mode("append"))
)
);