how to change this error
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dhanya shree Srihari
el 13 de Oct. de 2017
Comentada: Walter Roberson
el 15 de Oct. de 2017
Problem finding getMapfileName in com.mathworks.mlwidgets.help.HelpUtils: null
if isBetween(map_r(cnt1,cnt2),min(x1_r),max(x1_r))&& isBetween(map_g(cnt1,cnt2),min(x1_g),max(x1_g))&& isBetween(map_b(cnt1,cnt2),min(x1_b),max(x2_b))
result(cnt1,cnt2,3)=1;
5 comentarios
Respuesta aceptada
Walter Roberson
el 13 de Oct. de 2017
That code is not from Mathworks, it is from some private individual.
That code appears on page 11 of the pdf. At the top of that page, it show some commented out code that would define the function isBetween. You need to have created an isBetween.m containing that code (but not commented). Or better yet, use:
function r = isBetween(c, x, y)
r = x <= c & c <= y;
end
Note that my improved version also fixes a bug in the original code: the original code used a strict inequality x < c < y but the context of the calling code requires x <= c <= y .
The entire double "for" loop that calculates result could then be replaced by:
result = isBetween(map_r, min(x1_r), max(x1_r)) & ...
isBetween(map_g, min(x1_g), max(x1_g)) & ...
isBetween(map_b, min(x1_b), max(x1_b));
0 comentarios
Más respuestas (1)
Dhanya shree Srihari
el 15 de Oct. de 2017
1 comentario
Walter Roberson
el 15 de Oct. de 2017
That cannot be the full code. What you posted only has one line of code, all of which is a comment. Even if we guess at the line breaks, the line shown in the message as being in error is at most line 3, not the line 10 of the error message. This is important because I think that the error is on the lines you omitted.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!