how to change this error

2 ビュー (過去 30 日間)
Dhanya shree Srihari
Dhanya shree Srihari 2017 年 10 月 13 日
コメント済み: Walter Roberson 2017 年 10 月 15 日
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 件のコメント
Dhanya shree Srihari
Dhanya shree Srihari 2017 年 10 月 13 日
編集済み: Walter Roberson 2017 年 10 月 13 日
i dont know these code correct or not just i tried it.
Dhanya shree Srihari
Dhanya shree Srihari 2017 年 10 月 15 日
thank u so much , but one more error occured Undefined function or variable 'meanwater_r'.
Error in sc (line 10) water_r=meanwater_r; this is a full code of water %water %red water_r=meanwater_r; meanwater_r=mean(water_r); stdwater_r=std(water_r); %green meanwater_g=mean(water_g); stdwater_g=std(water_g); %blue meanwater_b=mean(water_b); stdwater_b=std(water_b); x=0:0.0001:1; %red-water w_r=normpdf(x,meanwater_r,stdwater_r); %red-forest f_r=normpdf(x,meanforest_r,stdforest_r); %red syms x y one=(exp((-(x-meanwater_r).^2)/(2*stdwater_r^2))/(stdwater_r*sqrt(2*pi))-y); two=(exp((-(x-meanforest_r).^2)/(2*stdforest_r^2))/(stdwater_r*sqrt(2*pi))-y); %water [x1_r, y1_r]=solve(one,two); x1_r=double(x1_r); y1_r=double(y1_r); %forest [x2_r, y2_r]=solve(two,three); x2_r=double(x2_r); y2_r=double(y2_r);

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2017 年 10 月 13 日
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));

その他の回答 (1 件)

Dhanya shree Srihari
Dhanya shree Srihari 2017 年 10 月 15 日
Error in sc (line 10) water_r=meanwater_r;
this is a full code of water %water %red water_r=meanwater_r; meanwater_r=mean(water_r); stdwater_r=std(water_r); %green meanwater_g=mean(water_g); stdwater_g=std(water_g); %blue meanwater_b=mean(water_b); stdwater_b=std(water_b); x=0:0.0001:1; %red-water w_r=normpdf(x,meanwater_r,stdwater_r); %red-forest f_r=normpdf(x,meanforest_r,stdforest_r); %red syms x y one=(exp((-(x-meanwater_r).^2)/(2*stdwater_r^2))/(stdwater_r*sqrt(2*pi))-y); two=(exp((-(x-meanforest_r).^2)/(2*stdforest_r^2))/(stdwater_r*sqrt(2*pi))-y); %water [x1_r, y1_r]=solve(one,two); x1_r=double(x1_r); y1_r=double(y1_r); %forest [x2_r, y2_r]=solve(two,three); x2_r=double(x2_r); y2_r=double(y2_r);
  1 件のコメント
Walter Roberson
Walter Roberson 2017 年 10 月 15 日
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.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by