Strange symbol in file name - outputting file from Xcode and loading into Matlab
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi all, I am trying to output a text file in C++ (using xcode on a Mac), and then upload the same data into Matlab.
However, the text file I output from xcode (which should be called '/Users/robinthompson/Documents/JTBWhenIsEpidemicOverPaper/MCMCResults_18351555Time_212.txt') only loads into Matlab from the command window if I write
load('/Users/robinthompson/Documents/JTBWhenIsEpidemicOverPaper/?MCMCResults_18351555Time_212.txt')
, where the question mark before the file name is instead a weird rectangle symbol...
Furthermore, because the weird rectangle symbol is not a standard character, the same command doesn't work to upload the file when I run the load command from a Matlab script...
This is driving me crazy - is there a solution? What is this strange rectangle? Thanks in advance!
댓글 수: 2
Walter Roberson
2019년 3월 21일
For debugging,
cd('/Users/robinthompson/Documents/JTBWhenIsEpidemicOverPaper');
dinfo = dir('*Results_18351555Time_212.txt');
for K = 1 : length(dinfo)
fprintf('Visible file name: "%s"\n', dinfo(K).name);
fprintf('Numeric equivalent: ');
disp(dinfo(K).name + 0);
fprintf('\n');
end
and show us the result
답변 (3개)
Robin Thompson
2019년 3월 21일
댓글 수: 1
Walter Roberson
2019년 3월 21일
The 8296 is unicode U+2068, "First Strong Isolate", which is sort of explained in the above link.
It is not at all clear where that came from. It might or might not be related to the fact that U+2068 could be broken up into space and 'h' -- that is, if a section of code was confused over whether a character vector was "wide" characters or not, then plausibly it might have tried to store space and 'h' there but accidentally ended up with U+2068 . But there is no apparent reason why your code might have wanted to store space 'h' .
Robin Thompson
2019년 3월 22일
댓글 수: 6
Walter Roberson
2019년 3월 22일
Time to use the debugger to see what the c_str returns. If it is okay then it would be time to debug Ntime4.open
Walter Roberson
2019년 3월 22일
Also, when you did the cout, did you happen to pipe the output to "od" or write it to a file and check the contents of the file in detail? With it being a non-printing non-spacing character, there is the possibility that it is there but just did not display in that context.
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!