So I have a file titled text.txt which contains the string, 'Hi There!'. Now, when I use the following code to extract the string into my variable, data, MATLAB seems to ignore the space in the string.
%% Code Snippet
fileName = 'text.txt'; %name of file containing the data to be sent
formatSpec = '%s'; %data type
fileID = fopen(fileName,'r');% data = textscan(fileID,formatSpec);
data = fscanf(fileID,formatSpec);fileID = fclose(fileID); %%
So, when I try to check the contents of 'data' in the command prompt:
>> datadata = 'HiThere!'
How do I make MATLAB scan the spaces in my character string?
Best Answer