How to comment a block in MATLAB, similar in C /**/ [duplicate] - matlab

This question already has answers here:
How can I do group commenting without commenting each line in MATLAB?
(5 answers)
Closed 6 years ago.
I want to know how to comment a block in MATLAB. I know that in the C language I use / *; But I could not find out about MATLAB.

You can comment out MATLAB blocks with
%{
Comments go here
%}
Outside comment

Related

How to define functions with multiple default parameters in Matlab? [duplicate]

This question already has answers here:
How to deal with name/value pairs of function arguments in MATLAB
(15 answers)
How do I set default values for functions parameters in MATLAB?
(17 answers)
Optional args in MATLAB functions
(4 answers)
Closed 3 years ago.
I am surprised that I couldn't find anything that exactly answers my question about this.
I want to define a function in Matlab where I can either enter a parameter or not.
What I mean is i.e. in Python I can write:
def x(a=0, b=2, c=4):
return
and can call it with either
x(b=2, c=4)
x(1, 2, 3)
x(a=2, c=4)
I already saw the exists functionality but that only works for the last parameter to be optional.
Is there any way to do this in Matlab, where I can put in the parameters as I like?

how to crop image in matlab using only for loop? [duplicate]

This question already has an answer here:
Zoom and Crop Image (Matrix)
(1 answer)
Closed 7 years ago.
i made it with Matrix.how can i make it with for loop
crop.m
function s=crop(f,m,n,x,y)
s=f(x:x+m,y:y+n);
this is code
crop1.m
function s=crop1(f,m,n,x,y)
for i=x:1:x+m
for j=y:1:y+n
s(i-x+1,j-y+1,:)=f(i,j,:);
end
end

What is the new syntax of flops(0) and qp() in Matlab 2014? [duplicate]

This question already has answers here:
MATLAB/octave count number of operations (flops)
(2 answers)
Closed 7 years ago.
I am running an old Matlab code, i.e., Version 5, and it seems some of the syntaxes have been changed in the newer versions of Matlab. I have Matlab 2014 and Want to know what is the new syntax for the codeflaps.
First I have some problems about flaps command which seems to be removed from newer version. So what I have as a code about it is bellow, Just the necessary parts are posted, Please tell me how can I modify it for running on new matlab.
flops(0) % and few lines after
initial_flops = flops;
Flop = [Flop, flops];
fprintf(' Number of flops in initial calculations: %i\n\n',initial_flops);
disp(' beta #flops(in K) ')
disp(Flop_report)
net_flops
Also, I would like to know is qp() an old function in Matlab 5?
If yes what is its alternative in New versions of Matlab?
The function no longer exists, to benchmark code use timeit or profile.

What does ~ mean inside the brackets of a function call in MATLAB? [duplicate]

This question already has answers here:
suppressing output variables in matlab
(2 answers)
Closed 8 years ago.
For example, I have a function
[power, capacity] = function_name(users, distance, radius)
and the function call is
[~, capacity] = function_name(users, distance, 5);
~ just means that you don't want to store the result in any variable.
here is a detailed explanation:
http://www.mathworks.com/matlabcentral/answers/72537-what-does-a-tilde-inside-square-brackets-mean
And the most relevant section: "when you use [~,palette], that means that you just want the second output of your function, and do not care the first one."

imwrite matlab "You may not have write permission." [duplicate]

This question already has an answer here:
I am encountering an error while using imwrite
(1 answer)
Closed 7 years ago.
I have this with imwrite in matlab it says: "You may not have write permission." I tried to change the format of the image but It doesn't work.
Check to see if that file already exists and is open somewhere outside MATLAB. It will fail if it is.