Problem to Read .txt file
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Akmal Rahmat
el 21 de Nov. de 2014
Comentada: Akmal Rahmat
el 21 de Nov. de 2014
Hello all.. I have problem to read my .txt file. I already convert my image to .txt file. My image size is 100x100. How to read it and use it in for loop ? here is my coding to change to image to .txt file.
a = imread('img2.jpg');
b = imresize(a,[100,100])
dlmwrite('test4.txt', b, 'delimiter', ',');
d = dlmread('test4.txt');
[x,y] = size(d);
i want to make comparison between two .txt file.That is why i need to read the .txt file.
2 comentarios
Respuesta aceptada
Thorsten
el 21 de Nov. de 2014
Editada: Thorsten
el 21 de Nov. de 2014
You probably should first have a look at your .txt file to check if is has reasonable values, all separated by commas (or blanks, other delimiters may alos work)
type test4.txt
If this is ok, you can read the files using
T1 = dlmread('testimage.txt');
T2 = dlmread('anotherimage.txt')
and compute the difference image (no need to use for-loops)
D = T1 - T2;
and find the nonzero entries
ind_nonzero = find(D~=0);
Más respuestas (1)
Ver también
Categorías
Más información sobre Convert Image Type en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!