필터 지우기
필터 지우기

How to include a punctuation in a string?

조회 수: 8 (최근 30일)
Kratos
Kratos 2015년 2월 27일
편집: Stephen23 2015년 2월 27일
Hello I have a text file which has
1-34-4-2
2-20-3-5
2-13-10-6
1-7-1-13
2-28-6-1
2-40-12-3
2-54-2-3
1-21-3-6
:
1-12-1-3
1-35-2-4
2-65-11-1
2-69-5-2
1-58-12-9
2-1-11-4
0-0-0-0
I am suppose to use this number to extract a word from another text file. Everything works fine until I get to line with the punctuation marks. How do I make sure that I don't get an error when I get there and include it in my string. The line after punctuation mark is a space that you have to include in the string. How do I write a code that takes in both the space and the punctuation mark?
  댓글 수: 1
Stephen23
Stephen23 2015년 2월 27일
편집: Stephen23 2015년 2월 27일
What exactly are you doing?
You do not tell us if you are reading this file into MATLAB, and if so with what functions, or if you are writing it by appending text to a file, or doing some other text-parsing operations... are we supposed to guess what you are doing and how you are doing it? Without seeing your code, how do we know what you have tried, and what could be changed to make it work?
You write that "Everything works fine"... but nowhere do you tell us exactly what that Everything is.
Please help us by reading this:

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by