error undefined key word key
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
for i =0:255
s(i+1)=i;
end
j=0;
for i=0:255
j=(j+s(i+1)+key(mod([i,8],256)));
s([(i+1),j])=s([j,(i+1)]);
end
while i am trying to execute this code i am getting the error undefined keyword key for double. please tell me the way to resolve it
채택된 답변
Walter Roberson
2016년 2월 26일
0 개 추천
I would be almost certain that the message is about undefined function key, not undefined keyword key. Are you expecting key to be a function or an array?
댓글 수: 10
praveena maddamsetty
2016년 2월 26일
편집: Walter Roberson
2016년 2월 26일
i am sorry i mentioned wrong the error is
Undefined function 'key' for input arguments of type 'double'.
please tell how to resolve it. and also for the statement stated below the code is correct or not tell me. stat:
j:=(j+s(I)=key[i mod keylength])mod 256;
code:
j=(j+s(i+1)+key(mod(i,8),256));
is it correct or not and '=' is the symbol for':=' or not
Walter Roberson
2016년 2월 26일
The first version looks like coding for a different language. I do not recognize the language, so I cannot offer a MATLAB version.
It looks like key is more likely to be a vector that uses 0-based indexing such as is common in C or C++. But neither C nor C++ use := as the assignment operator. In some cases, MuPAD can use 0 based indexing, and MuPAD uses := as the assignment operator, but in MuPAD the "=" in the middle of the line wold be a comparison, and in MuPAD comparisons yield "true" or "false" or "FAIL", none of which can be taken mod 256.
praveena maddamsetty
2016년 2월 27일
it is to be executed in MATLAB only not MuPAD. and also suggest me regarding the error. shall we declare the key or what i can't understand. please read below attachment you can get idea regarding what i am asking. i want to use ksa,prga,bbs algorithms for my own data. please suggest how to do that.
Walter Roberson
2016년 2월 27일
Sorry, that algorithm uses RC4, which has only recently come off patent in USA, and might have been renewed and might be still patented in my country or yours. It is legally unsafe for me to read the algorithm until I know for sure that the patent is extinguished.
praveena maddamsetty
2016년 2월 27일
편집: Walter Roberson
2016년 2월 27일
ok Roberson thank you for the reply. if possible can you please tell me the arnold inverse scrambling. i wrote the code below for scrambling but i don't know how to write inverse to obtain original image. and also tell me both scramble and inverse because the code i mentioned below is taking more time to execute even the elapsed time is less
in=imread('cameraman.tif');
iter=200;
%function[out]=arnold(in,iter);
if(ndims(in)~=2)
end;
[m,n]=size(in);
if(m~=n)
end
out=zeros(m);
n=n-1;
count=0;
for j=1:iter
for y=0:n
for x=0:n
p=[1 1;1 2]*[x;y];
out(mod(p(2),m)+1,mod( p(1),m)+1)=in(y+1,x+1);
if(out==in)
imshow(out,[])
count=count+1
end
end
end
in=out;
end
Walter Roberson
2016년 2월 27일
Note: you will need to expand the comments to find that one.
praveena maddamsetty
2016년 2월 28일
thank you but i really didn't understand what are mentioned in those comments. if possible tell me in brief how can i obtain inverse arnoldfor the above mentioned code.
Using the same variable names as you used before:
%save the scrambled image. This is based upon using the same
%variable names as you already had, where "out" is the result
%of the arnold scrambling
cat_out = out;
%now apply the cat map _forward_ on an array which consists
%of the logical indexing position numbers for the appropriate
%array size
[m, n] = size(cat_out);
in = reshape(1:numel(cat_out), size(cat_out));
%notice this section is the exactly same as what you had.
out=zeros(m);
n=n-1;
count=0;
for j=1:iter
for y=0:n
for x=0:n
p=[1 1;1 2]*[x;y];
out(mod(p(2),m)+1,mod( p(1),m)+1)=in(y+1,x+1);
if(out==in)
imshow(out,[])
count=count+1
end
end
end
in=out;
end
%now out is the arnold-map scrambled version of the logical
%index numbers. So for example if "2" shows up in
%row 17 column 59, it means that the cat map process moved
%the pixel at location (2,1) to row 17 column 59. And that
%in turn would mean that we should take whatever is at row 17
%column 59 of the arnold scrambled image and move it to position
%(2,1) to unscramble the image.
unscrambled_image = zeros(m, m, class(cat_out));
unscrambled_image(out) = cat_out;
and now unscrambled image is the result of unscrambling the input that was the scrambled image.
praveena maddamsetty
2016년 2월 28일
i am very thankful to you. thank you so much for patiently clarifying my doubts
praveena maddamsetty
2016년 2월 28일
i am getting other problem. when i am running the code no error iscoming and no output also. i am just getting the values that too those values are not stopping till i am terminating i.e ctrl+c. aafter terminating i am getting the scrambled image please tell how to resolve it
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Common Operations에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
