필터 지우기
필터 지우기

can you please help how to convert a csv file into ascii format?

조회 수: 55 (최근 30일)
I have a .csv file from a graph. I need to convert it to an ascii file format. I need to load this .ascii file on another software. please help thanks
  댓글 수: 6
Stephen23
Stephen23 2023년 4월 13일
편집: Stephen23 2023년 4월 13일
@Sammy: Your file is already UTF8 and contains only ASCII characters. But it does have a BOM:
I removed the BOM (using Notepad++) and uploaded it here.
Adrienne Winter
Adrienne Winter 2024년 3월 14일
I had an issue where my csv was being read as an ASCII in Matlab - I saved the csv again with UTF-8 (with no BOM) from Notepad and this worked to make the csv readable (as I saw it was saved with BOM).
For anyone else who may have the same issue as me.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2018년 3월 13일
The file that was uploaded is already pure ASCII.
The only thing I notice is that it uses newlines alone for end of line; it is possible that the other program needs carriage-return as well as newlines. If so then
S = fileread('Wavelength (nm)_Counts.csv');
S = regexprep(S, '\n', '\r\n');
fid = fopen('Counts_with_CR.csv', 'w');
fwrite(fid, S);
fclose(fid);
Now Counts_with_CR.csv will have the same content but with CR/NL delimiter.
  댓글 수: 2
Surya Gnyawali
Surya Gnyawali 2018년 3월 14일
편집: Surya Gnyawali 2018년 3월 14일
Thanks a lot. makes much more sense. The only confusion is that the output 'S' is now a 1x4059 char. Fid is #3. Which file should I use for uploading to CytoSpec software as pure ascii file? Please advise.
Walter Roberson
Walter Roberson 2018년 3월 14일
The code writes out a file Counts_with_CR.csv which would be what you would try with the CytoSpec software.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by