How to include a punctuation in a string?

13 views (last 30 days)
Kratos
Kratos on 27 Feb 2015
Edited: Stephen23 on 27 Feb 2015
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 Comment
Stephen23
Stephen23 on 27 Feb 2015
Edited: Stephen23 on 27 Feb 2015
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:

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!