How do you write this "| "symbol in MATLAB?
Mostra commenti meno recenti
How i would write that symbol in MATLAB?

i left it out and even tried'/'
but i keep getting warnings within the script

thank u!
will attach my code too
function res=disttrans(image,mask)
backmask=rot90(rot90(mask)); % rotating forward mask by 180 degree to make backward mask
[mr,mc] =size(mask);
if ((floor(mr/2)==ceil(mr/2))(floor(mc/2)==ceil(mc/2)))
then error('The mask must have odd dimensions.')
end
[r,c]=size (image);
nr=(mr-1)/2;
nc=(mc-1)/2;
image2=zeros(r+mr-1, C+mc-1);
image2(nr+1:r+nr, nc+1:c+nc)=image;
image2(image2==0) =Inf;
image2(image2==1) =0;
for i=nr+1:r+nr
for j=nc+1 : c+nc
image2(i,j)=min (min(image2(i-nr:i+nr,j-nc:j+nc)+mask));
end
end
for i=r+nr:-1:nr+1
for j=c+nc:-1:nc+1
image2(i,j)=min(min(image2(i-nr:i+nr,j-nc:j+nc)+backmask));
end
end
res=image2(nr+1:r+nr,nc+1:c+nc);
1 Commento
Rena Berman
il 8 Dic 2021
(Answers Dev) Restored edit
Risposta accettata
Più risposte (1)
If for whatever reason you cannot type the | character (which on my QWERTY keyboard is Shift plus the key to the far right of the second row of keys) you could call the function form of that operator using the or function.
x = 2;
if (x < 1) | (x > 3)
disp('Out of bounds')
else
disp('In bounds')
end
if or(x < 1, x > 3)
disp('Out of bounds')
else
disp('In bounds')
end
Categorie
Scopri di più su Big Data Processing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!