This snippit works in base program, but not in a function.
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
Have tried strjoin and several other commads with no success. Help?
opathName=[opath,'\',iname, num2str(a),'.tif'];
imwrite(uint16(I (:,:,a)),opath_ opathName,'tif','Compression','none'); tiff
댓글 수: 7
Adam
2015년 11월 16일
I assume that when you use a function you have passed in or created in its workspace all the variables it needs for that instruction?
That is the most obvious reason why something would work on command line, but not in a function - functions have their own sealed workspace with nothing in it that isn't either passed in or created (or global parameters, but even these still have to be declared in the function to be used)
Walter Roberson
2015년 11월 16일
What error message do you observe?
SteveH
2015년 11월 16일
SteveH
2015년 11월 17일
편집: Image Analyst
2015년 11월 17일
Walter Roberson
2015년 11월 17일
You should get in the practice of using fullfile() and sprintf()
My guess is that either your opath or your iname is a cell array of strings when you have the problem. You did not show how you constructed them so we cannot point out the reason as yet.
Image Analyst
2015년 11월 17일
That still won't work. What a mess - I'd much rather maintain Walter's code than yours, and I suggest you take his suggestion. By the way, to fix, change opathName to opath_name.
SteveH
2015년 11월 17일
답변 (0개)
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!