I am not getting the correct keyword?
Show older comments
Actually I am storing single precission values in a variable and want to read that variable in uint8 precission and store it in another file for the purpose I write scripts as fwrite(file1,readtext(inertial_data,'uint8'),'uint8'); it displays an error stating----Undefined function 'readtext' for input arguments of type 'single' and another script as fwrite(file1,fread(inertial_data,'uint8'),'uint8'); it displays error stating------Invalid file identifier. Use fopen to generate a valid file identifier.
what will be the correct identifier to read a single precission variable.
Accepted Answer
More Answers (1)
Image Analyst
on 24 Nov 2015
Why do you think you should have a function called readtext()? I don't. What happens when you do this:
>> which readtext
'readtext' not found.
Also for the other error, the file identifier, which you call file1, it says is unidentified. Did you ever have code like this to define file1?
fullFileName = 'C:/whatever/file.dat';
file1 = fopen(fullFileName);
if file1 == -1
% File not found
errorMessage = sprintf('Error: this file does not exist:\n%s', fullFileName);
uiwait(errordlg(errorMessage));
return;
end
Categories
Find more on Low-Level File I/O in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!