I want to print a vector of unsigned integers to a text file, with a space between each number. But the file I get is just weird symbols. I must be doing some trivial mistake, it's not the first time it happens, I can't remember what could be the fix. It's happening on R2018b (but I remember it happening on older versions as well). Here's sample code below:
cleardata = uint32(zeros(1, 1615));data(1:2:50) = 1;output = fopen('output.txt', 'wt');fprintf(output, '%d ', data);fclose(output);
Output I get is: ‱‰‱‰‱‰‱‰‱‰‱‰‱‰‱‰‱‰‱‰‱‰‱‰‱‰‱‰‱‰‱‰‱‰‱‰‱‰‱‰‱‰‱‰‱‰‱‰‱‰‰‰‰‰‰‰‰‰‰ …
Output I want is: 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 …
Best Answer