read specific values and ignore them using fread
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Nick Vasilakis
el 31 de Mzo. de 2022
Comentada: Nick Vasilakis
el 31 de Mzo. de 2022
Hello!
So I'm trying to find a way to read from a matrix of size 1x2000 the values that are assigned in positions 750 to 834 using the fread command.
Basically I open the given file that I want to read,using the command:
fid=fopen('Alien_Message');
im_1=fread(fid,251,'uint8'); %read the main header of the file and the line header and toss them away
im_2=fread(fid,[],'uint8'); %This is the part where I want to read the 750 to 834 bitstream and toss them away
Any idea on how can I manage this?
0 comentarios
Respuesta aceptada
yanqi liu
el 31 de Mzo. de 2022
yes,sir,may be use loop to make it,but the result should be check,such as
fid=fopen('Alien_Message');
im_1=fread(fid,251,'uint8'); %read the main header of the file and the line header and toss them away
im_2 = [];
for i = 1 : 834
tmp = fread(fid,1,'uint8');
if i >= 750
im_2 = [im_2 tmp];
end
end
3 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!