MATLAB: How to assign a numeric value to a picture file

.gif numeric value assign file

ok so im having a problem with converting a file to numeric value. i have used str2num and has given me no luck. what i want to do is basically make a picture file for example x.gif equal to 1. I have multiple .gif files and want to assign values to each .gif file. how would i do this? thanks.

Best Answer

Jack, we're not sure what you want. So you read in your gif file
myGif = imread('x.gif');
Now you have all the pixels in the myGif array. So what do you want to do with that? Assign all the values to 1?
myGif(:) = 1; % Assign all pixels a value of 1, erasing previous values.
Why would you want to do that???
To process a sequence of files, see the FAQ for code samples: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F