i want to read a file name is imData.txt which has 9600 arbitrary float numbers. and store in array of size 80*120 after read i want show image of that array??
No products are associated with this question.
For data in that format, load() should work, as would textscan(). You would not need to reshape() the data after either of those.
image() and imagesc() do not convert to uint8. However, when image() is passed floating point data (instead of uint8 or uint16) then image will expect the data to be in the range of 0 to 1, whereas imagesc() would rescale the floating point values so that the minimum mapped to 0 and the maximum mapped to 1.
What you should do about the fact your data ranges from 0 to 619 depends on your purposes. Are you okay with the loss of resolution if you rescale to 0 to 255? If so then
scaleddata = uint8(YourData ./ max(YourData(:)) .* 255);
Or you could leave the data in floating point format if you do not specifically need it to be uint8()
scaleddata = YourData ./ max(YourData(:);
The above assumes that for each file, the maximum value of the file should be treated as being full brightness. If there is some other value that should be treated as maximum brightness (e.g., 640) then use that value in place of max(YourData(:))