How to include a punctuation in a string?

8 次查看(过去 30 天)
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