Blank Space that isn't a Blank space
10 ビュー (過去 30 日間)
古いコメントを表示
Hi all,
I have a strange thing happening with a string. I am reading in a string from a binary file and it puts a blank space at the end of the string. For example, the string would read x='1234567 '. Im trying to remove that last space. I have tried strtrim and x(x~=' ') and regexprep but can remove this space. The problem is probably because strcmp(x(8),' ') returns 0 so this space is somehow not equal to a blank space. If anyone has ever seen this any help would be greatly appreciated.
Thanks
Brendan
PS. I can't just cut off the last space because I don't know if it will always be there so I need to test to make sure its blank.
0 件のコメント
採用された回答
Honglei Chen
2012 年 8 月 8 日
編集済み: Honglei Chen
2012 年 8 月 8 日
Does deblank work for you? At least worth a try.
0 件のコメント
その他の回答 (1 件)
Brendan
2012 年 8 月 8 日
2 件のコメント
Honglei Chen
2012 年 8 月 9 日
strtrim only deals with white spaces while deblank also takes care of null spaces.
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!