how to fill colors between contours in matlab 
This can be done by using the get command to get individual components from
the graph. For example:
[x, y, z] = peaks; % Generate some data
figure; surf(x, y, z); % Show
figure;[c, h] = contourf(x, y, z, [0 0]); % Build and show contour plot
patches = get(h, 'children'); % Get different patches
set(patches(1), 'facecolor', 'r') % Colour one red

Fill remainder of data set with nans in Matlab 
If you are sure that the data only needs to be padded with NaN at the end,
you can simply use:
pad_length = length(Jday)  length(Dat);
pad = ones(pad_length,1)*NaN;
Dat = [Dat;pad];

How to prevent the fill command in MATLAB from creating boxes without "corners" 
The function fill appears to leave space for corner markers if they are not
explicitly defined. Hence, calling fill with the marker property will solve
your problem. However, since markers and linewidths seem to work on
different scales, you will have to play around with the marker size to get
smooth edges.
Example:
fill(X,Y,'r','FaceAlpha',0.5,'EdgeColor', 'k',...
'LineWidth', 5,'EdgeAlpha',1 , 'marker', '.', 'markersize', 15)

Matlab  Check if function handle is a particular function or function type 
How about using func2str?
If this is an inbuilt function, it should just return a string containing
the function name; if it is an anonymous function it should return the
anonymous function (including @).
h1 = @(x) x.^2;
h2 = @mean;
str1 = func2str(h1); %str1 = "@(x) x.^2"
str2 = func2str(h2); %str2 = "mean"
You can also use isequal to compare two function handles (ETA: this will
not work to compare two anonymous functions unless one was created as a
copy of the other):
isequal(h1,@mean); % returns 0
isequal(h2,@mean); % returns 1

Converting MATLAB 'imagesc' function to work with R's 'imagesc' from R's 'matlab' library 
As I read the question and the linked material and some other material
found with Google, you want the combined capacities of the image and axis
functions in R. Some of the other material said that imagesc really only
relabels the axis annotation. (And it has some additional color scaling
capacity that you don't seem to be requesting.) Reading images in from
files may take some extra packages. There is a grImport package with useful
capabilities for pdf. There are also packages that specialize in particular
formats, eg. tiff or rtiff. If you have a modes sized matrix to plot, you
should offer dput(mat). In the absence of an example and specific
directions can offer this adaptation of an example in the middle of the
Examples section of ?image.
> image(t(volcano)[ncol(volcano):1,]) #

Tranferring data from a function to a callback function within a GUI in MATLAB 
I think what you want is to use guidata, there's a very good explanation
here and a post here on the same topic. You could also use, setappdata,
but that's similar to global data.

How to fill a list with a recursive function in R? 
Your functions assumes that R is using callbyreference semantics which is
wrong. When you pass a list into a function and modify it, the original
list will not be changed.
What you need to do is to use the return value of Recall and concatenate
the results as is the following example:
f = function (x) {
if (x <=0 ) {
return( c() )
} else {
return( c(Recall(x1),x) )
}
}
# f(5)
# [1] 1 2 3 4 5

How to fill List inside function (C#) 
You can't. You need to either initialize it as a List<object>:
List<object> strList = new List<object>();
Or change the parameter type:
public static void fileToList(string path, List<string> lst,
stringProcessing SP)

Function to fill linked list but for n lists types 
If you want to have many lists of different contents, a common way is to
have a common node structure as base for all lists.
struct base_node
{
struct base_node *next;
};
Then you have that structure first in all other structures used for your
lists:
struct some_node_data
{
struct base_node node; /* Note: not a pointer */
/* All other data... */
};
(Note: Having the base node structure as a member in the new structure,
it's kind of like C++ inheritance.)
Now you can cast a pointer to the above structure as a pointer to the
base_node structure, and use that.
void add_tail(struct base_node **head, struct base_node *node)
{
/* Add `node` at the end of the list pointed to by `*head` */
}
/* ... */
struct some_node_data *some_data_head = NULL;
struct some_node_data

Dynamically fill PHP cookie with array data in a JavaScript function 
If you want to pass a variable from javascript to php you need to use AJAX,
and you need to save it for example in a session or database.
Remember that php is a server side language, connection to the server
closes after you receive a response. To send data to the server you either
have to refresh the whole page, or use AJAX.
Also, there is no distinction between javascript cookies an php cookies 
they are the same.
Check out this website how to set cookies in js
http://www.w3schools.com/js/js_cookies.asp
Also, if you're using jquery it's much easier:
$.cookie('somecookie', 1);
How to set/unset cookie with jQuery?
But you need to use a plugin for that
https://github.com/carhartl/jquerycookie

Create an array of custom Object to fill it and take his content to fill a UITableView 
In  (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath you do not initialize cells
for your TableView. Add the below code to this method before the code that
you already have
static NSString *CellIdentifier = @"Cell Identifier";
UITableViewCell *cell;
if (cell == nil) {
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
and make sure you return cell; at the end of that method
Also make sure you implement the rest of the necessary TableView delegate
methods:
 (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
 (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

using tic toc function in matlab 
It depends on how MATLAB's JIT engine can improve the performance of for
loops. For small matrices it works fine but for large ones not really.
Seems for i less than 60, first method is faster, but not for larger
matrices. Try this benchmark
for j=[6 30 60 100 200 400 600]
disp(['j=' num2str(j)]);
i=j;
Savings = zeros(i,j);
Costs = magic(600);
tic;
for mm=1:1e2
for x=2:i
for y=2:j
if(x ~= y)
Savings(x,y) = Costs(x,1) + Costs(1,y)  Costs(x,y);
end
end
end
end
first=toc;
disp(num2str(first));
Savings = zeros(i,j);
tic;
for mm=1:1e2
Ix=2:i;
Iy=2:j;
I = false(i,j);
I(Ix,Iy) = bsxfun(@ne, Ix', Iy);
S = bsxfun(@p

Marcumq Function In MATLAB 
EDIT: OK so I misunderstood the function initially.
The value you get for Q after running your script is only based on the last
value in xout so that is probably not what you want.
Can you describe what you are trying to do?
You value for lambda is not a scalar, but a vector. Is that what you want?
That means that for each time you call marcumq, you get a vector of values
out.
Q = 1 seems to happen when your first input is bigger than your second
input  these are your integral limits, so if the lower limit is bigger
than the upper, no integration will happen.
From a brief test of your code, your xout values are higher than your
lambda values. Also are you sure you want to be using xout? These are just
the bin values, which are equal to z.

Error when using function in MATLAB 
Your function is returning f as the output of sprintf, which is a char
array. You can't put this into x, because x has already been defined as
containing doubles with x(1)=0.3;
You may want to use sprintf to print the value to screen so you can check
it, but your function should be returning a number, value.
ETA: As Rody explained in the comments, format can be used to change how
Matlab displays numbers, but the precision does not change. Similarly,
sprintf can control the format but it doesn't change the value itself. Try
these lines at the command line:
format short
value = 3.000000000012
format long
value

How to Use princomp function in matlab 
Looks like you need a good PCA tutorial.
Also, see princomp documentation.
As mentioned in the comments, Cross Validated may be a better place than
here to ask questions about PCA.
Cheers.

Matlab im2col function 
why im2col? why not nlfilter?
>> trimmed = nlfilter( image, [filter_size filter_size],...
@(x) treimmean( trimmean(x, percent), percent ) );
Are you sure you process the entire image?
i and j only goes up to rows and columns respectively. However, when you
update trimmed you access in and jn. What about the last n rows and
columns?
Why do you apply trimmean twice for each block? Isn't it more appropriate
to process the block at once, as in trimmean( x(:), percent)?
I believe the results of trimmean( trimmean(x, percent), percent) will be
different than those of trimmean( x(:), percent). Have you give it a
thought?
A small remark, it is best not to use i and j as variable names in matlab.

matlab 'fit' function for python 
Try scipy's curve_fit() for general fitting of a function.
For specific interpolations, have a look at scipy's interploation
functions.
does this answer your needs?

Minimize Function in Matlab 
You generally need to some things about the function in order to be sure
that a local minimum is, in fact, the global minimum (for example, the
function is convex). Is this the case?
Assuming it is, or you just want to find a local minima, consider the
following example:
clear all
close all
clc
f = @(x) (x+3).^2;
x = linspace(5,5,100);
y = f(x);
plot(x,y);
ymin = fminsearch(f, 0);
printf('Local min found at: %f
', ymin);
Which displays a simple graph and prints:
Local min found at: 3.000000
Note that you have to specify a starting point for the search. In this
case, I used 0. When you only give fminsearch a single parameter, it
expects the parameter to be a structure, which it doesn't look like you're
using.
From help fminsearch:
X = fminsearch(PROBLEM) finds the minimum f

Matlab Stepinfo Function 
From the help:
The response has settled when the error y(t)  yfinal becomes
smaller than a fraction ST of its peak value.
This means that it's the fraction of the peak error value, not an absolute
threshold  e.g. if your system was something that started at around 30,
and eventually rose and settled at near 180 (yfinal = 180), then the max
error is 150, and the threshold would be 0.01*150 = 1.5. So it would need
to get to 178.5 (1801.5).
If your system started at 100 and settled at about 180, your max error is
80, and the threshold is then only 0.8, so your value needs to be at 179.2.
Look at what your min(ee) and max(ee) are and then decide on what a
sensible threshold is.
EDIT:
If you want to set a fixed threshold you'll have to calculate it on the
fly:
desiredthreshol

fit function of Matlab is really slow 
I would apply some of the options available with fit. These include
smoothing by setting SmoothingParam (your data is quite noisy, the
alternative of applying a time domain filter may also help*), and setting
the values of your initial parameter estimates, with StartPoint. Your fits
may also not be converging because you set your tolerances (TolFun, TolX)
too low, although from inspection of your fits that does not appear to be
the case, in fact the opposite is likely, you probably want to increase the
MaxIter and/or MaxFunEvals.
To figure out how to get going you can also try the SpectrOMatic toolbox.
It requires Matlab 7.12. It includes a script called GaussFit.m to fit
gauss4 to data, but it also uses the fit routine and provides examples on
how to set and get parameters.
Note th

Need help plotting this function in Matlab 
So far I'd proceed this way:
clc,clear
T = 3;
mu = 135;
f = 1E04:.1:1000;
theta = ones(size(f));
theta(f < 270)= 0;
integrative = zeros(size(f));
for ii = 1:numel(f)
ff = @(x) int_y(x, f(ii), theta(ii));
integrative(ii) = quad(ff,0,2000);
end
Imm = ((2*T)./(pi*f)).*log(2*cosh(mu/(2*T))) + (f/pi).*integrative;
Imm1 =
exp(interp1(log(f(1:2399)),log(Imm(1:2399)),log(f(2400):.001:f(2700)),'linear','extrap'));
Imm2 =
exp(interp1(log(f(2985:end)),log(Imm(2985:end)),log(f(2701):.001:f(2984)),'linear','extrap'));
plot([(f(2400):.001:f(2700)) (f(2701):.001:f(2984))],[Imm1 Imm2])
hold on
axis([0 1000 1.0 1])
plot(f,Imm,'g')
grid on
hold off
with
function rrr = int_y(x,f,theta)
T = 3;
mu = 135;
rrr = ( (sinh(x./T)./(cosh(mu/T) + cosh(x/T)))  theta ) ./ (f.^2 
4.*(x.^2));
en

What is the function 'selectifr' from Ox in Matlab 
I've never used Ox but after a quick google search going from the docs.
The selectifr function returns an s x n matrix,
selecting only those rows from ma which have at least one nonzero element
in the corresponding row of mifr.
Where in the function selectifr(const ma, const mifr);
ma = m x n matrix to select from
mifr = m x q boolean matrix specifying rows to select
So essentially you are picking specify dates of the [bid,ask]. In term's of
matlab, I think an intersect of union might be what you need here

matlab variable shared to another function 
Indirectly from Matlab guidata documentation:
in the first callback function:
function first_Callback(hObject, eventdata, handles)
% add some additional data as a new field called x
handles.x = 1;
% Save the change you made to the structure
guidata(hObject, handles)
in the second callback function simply use handles.x because handles is
already passed as a parameter to the second callback, if they belong to the
same parent figure.
function second_Callback(hObject, eventdata, handles)
% a will have the value 1
a = handles.x;
Note: Even though you are saving handles to hObject (which is the current
object that has called the callback function), the handles structures is
visible to other objects on the same figure. Saving handles structure to
hObject and saving to the parent figure a

How to get the variable value from a function in a same m file in matlab? 
It looks like you are already doing what you need to do, in fact, it looks
like you are using two methods in parallel. You save the variable citra1 to
the handles structure in pushbutton1_Callback and you are accepting that
structure as a user variable in both callbacks. You are also saving handles
with guidata.
See Sharing Data Among a GUI's Callbacks and guidata to see how you to
extract citra1 from handles in either case.
If you are setting the callbacks correctly, including the handles
structure, then the short answer is to use handles.citra1 instead of just
citra1 in your second callback. I highly recommend reading the callback
documentation to understand what is happening, however.

How do I put a folder as an input in a matlab function? 
If you want each row in a to have a string and two numbers, it should be a
cell array:
...
a=[]
for i ...
...
a{i}={files{i} u q};
end
...
To get to the filenames you do
a{1}{1}
ans=
file1.jpg
To get to the numbers you do
a{1}{2},a{1}{3}
(to get std and mean of file1.jpg, resp.)
Another way to do it is to make a a struct array.

surface(2d) fit in MATLAB with anonymous function 
You need to add the parameter 'numindep' = 2 which indicates that your fit
is for a surface (i.e has two independent variables).
Here's an example using your function with the Franke data using a string:
load franke
ft = fittype('myfun(beta1, beta2, beta3, [x, y])', 'numindep', 2)
[results, goodness] = fit([x, y], z, ft)
Here's an example using your function with the Franke data using an
anonymous function:
load franke
ft = fittype(@(beta1,beta2,beta3, x, y)myfun(beta1, beta2,beta3, [x, y]),
'numindep', 2)
[results, goodness] = fit([x, y], z, ft)

surfnorm function more efficient way Matlab 
I wonder if the following code would help you. There are three steps here.
Create 500 randomly spaced points (x,y), and compute a corresponding value
z (the height of the surface) for which I chose a sinc like function
Resample the random points using the TriScatteredInterp function  this
permits me to obtain points on an evenly sampled grid that "roughly
correspond" to the initial surface
Compute the normal to "some points" on that grid (since there are 480x640
points, computing the normal at every point would just create an impossibly
dense "forest of vectors"; by sampling "every 10th point" you can actually
see what you are doing
The code I used was as follows:
randomX = rand(1,500);
randomY = rand(1,500);
r = 5*sqrt(randomX.^2 + randomY.^2);
randomZ = sin(r) ./ r;
% resample the

Many step picewise function in Matlab? 
I use this tool. For example, given this set of piecewise functions:
x < 5, y = 2
5 <= x < 0, y = sin(x)
0 <= x < 2, y = x.^2
2 <= x < 3, y = 6
3 <= x, y = inf
So, as a function of any variable x, just call it like this:
y = piecewise_eval(x,[5 0 2 3],{2,'sin(x)','x.^2',6,inf});

Matlab function argument passing 
It really depends.
From the top of my head (meaning, I could be wrong):
MATLAB uses a lazy copyonwrite scheme for variable assignment. That
means,
a = rand(5);
b = a;
will not create an explicit copy of a. In essence, b is just a reference.
However, when you issue
b(2) = 4;
the full contents of a will be copied into a new variable, the location
where b points to is changed to that new copy, and the new contents (4) is
written.
The same goes for passing arguments. If you issue
c = myFcn(a, b);
and myFcn only reads data from a and b, these variables are never copied
explicitly to the function's workspace. But, if it writes (or otherwise
makes changes) to a or b, their contents will be copied.
So, in your particular case, I think the peak memory for
r = myFcn( [some comp

'undefined function or variable'. Matlab 
You are just accessing a variable (Indicator) before it has been created.
Matlab doesn't know if Indicator(i+1) is referring to a function or a
variable and so generates the ambiguous error message that you are getting.
If during the first executing of your loop code,
if(i>Start_Index(TestVal+2))
is false, then
Indicator(i)=k*sc*Index(i)+(1k*sc)*Indicator(i+1);
will be executed before the variable Indicator has been created.
As Horchler commented, the error is caused by the code
Start_Index=size(Index);
which should be
Start_Index=length(Index);
As I commented, you can reproduce the error by calling vidya with a row
vector. For example:
vidya(1:10,3,4)

Matlab Function with Varying parameters 
You're almost there. Note that you've written
function [y] = part1(a,x)
but you call it in your script as
part1(x,a)
so you should probably correct that.
A few things jump out at me:
You never assign the output of part1(x,a) to anything. You're told that
Results should be stored in a solution matrix using a different row of
the solution matrix for each value of a.
What I take this to mean is that the 1st row corresponds to part1()
evaluated for the 1st element of a. Since we're operating on x which is a
vector, that row will have multiple columns. Your output is indeed a
matrix. In your case, length(pi:0.1:pi) == 63, therefore size(y) == [4
63], where y is your output matrix.
Your for loop is backwards. You're told to accept scalar a and vector x.
There

Extending subplot function in matlab 
If you want to use subplot, instead of directly specifying axes positions,
you have to split, in your mind, the figure into the smallest uniform
areas, and then combine them into plots. For example, to have three
equalsized plots, one on top and two on the bottom, you'd do:
firstAxes = subplot(2,4,2:3);
secondAxes = subplot(2,4,5:6);
thirdAxes = subplot(2,4,7:8);
If you want to perform more complex actions, such as putting text in a
specific position, it's better to create display objects directly. For
example:
fh = figure;
hiddenAxes = axes('parent',fh,'units','normalized','position',[0 0 1
1],'color','w','xcolor','w','ycolor','w','xlim',[0 1],'ylim',[0 1]);
text('parent',hiddenAxes','position',[0.25 0.9 0.5
0.1],'horizontalAlignment','center','string','this is a centered

matlab function handle inside gui 
I would go for
get(handles.edit1,'value')
All your uicontrols are stored in the handles. Knowing the tag of your
uicontrol (for your edit box I guess this is edit1), you can get the
handles of this object with handles.edit1.
You can even write
my_value = get(handles.edit1,'Value');

method in randfeatures function of Matlab 
Type edit randfeatures and you will see the following just below the help:
% References:
% [1] Leping Li, David M. Umbach, Paul Terry and Jack A. Taylor (2003)
% Application of the GA/KNN method to SELDI proteomics data. PNAS.
% [2] Huan Liu, Hiroshi Motoda (1998) Feature Selection for Knowledge
% Discovery and Data Mining, Kluwer Academic Publishers
% Example reference:
% [3] D. T. Ross, et.al. (March, 2000) Systematic Variation in Gene
% Expression Patterns in Human Cancer Cell Lines, Published in Nature
% Genetics, vol. 24, no. 3, pp. 227235
I leave the heavy reading up to you.

structure field is function matlab 
You can set the 'shape' field to a function handle:
module = struct('dim', [3 1 0.05], ...
'point', [0 0 0], ...
'shape', @()cubeshape(module.dim,module.point))
And then access the value of the 'shape' field via
module.shape()
However, you'll find that if you change the value of module.dim in your
struct, the values returned by module.shape() do not get updated. This is
because the two function handle parameters gets set at the time of
instantiation. You probably don't want this. Instead you can pass
module.dim and module.point into your function handle as arguments:
module = struct('dim', [3 1 0.05], ...
'point', [0 0 0], ...
'shape', @(dim,point)cubeshape(dim,point))
module.shape(module.dim,module.point)
It's less g

How can I overload find function in Matlab 
As Lucius Domitius Ahenobarbus noted in the link he gave, there are strict
rules of when you can overload functions in matlab.
Take the following class:
classdef myclass
methods
function find(self)
fprintf('find(myclass) has been called.
');
end
end
end
And execute
X = [myclass myclass myclass]
find(X)
This gives the following output:
X =
1x3 myclass with no properties.
Methods
find(myclass) has been called.
What you do in your overloaded find function is up to you. Just write a
function that prints out the indices of the elements that match what you
call "these properties", whatever that is.

Matlab editor won't save function 
I believe this is a problem with Windows XP and MATLAB 2013. I had the
same problem when I tried to edit a file in 2013a, but did not have the
problem in 2012a.
I have heard that it will also go away on Windows 7 or more recent versions
of Windows, but I haven't verified.

Possible bug in Matlab's "fileattrib" function. Workaround? 
One way to deal with this is not to depend (solely) on the fileattrib
command.
In order to determine whether something is a file or directory, you can
check how it registers when using the dir command on the containing folder.
Its a bit of a hassle, but when using dir called on the folder (won't work
when called on the file directly) you seem to get the correct output.
A quick and dirty alternative would of course be to put your entire
handling in a try / catch construction and if one fails simply try the
other.

about matlab's Adaptfilt. function 
adaptfilt is a class definition, of which fdaf is a member. Then, you use
the dot operator to access the static member of the class. See Static
Methods in the MATLAB documentation. In summary, to define a similar
function yourself use
classdef MyClass
...
methods(Static)
function y = yourFunc(x)
...
end
end
end
The result you're getting from adaptfilt.fdaf is in fact an object. The
adaptfilt.fdaf documentation page outlines the members of the object.

MATLAB function passing by reference 
with the reference:
MATLAB uses a system commonly called "copyonwrite" to avoid making a
copy of the input argument inside the function workspace until or
unless you modify the input argument. If you do not modify the input
argument, MATLAB will avoid making a copy. For instance, in this code:
function y = functionOfLargeMatrix(x) y = x(1); MATLAB will not make a
copy of the input in the workspace of functionOfLargeMatrix, as x is
not being changed in that function. If on the other hand, you called
this function:
function y = functionOfLargeMatrix2(x) x(2) = 2; y = x(1);
then x is being modified inside the workspace of functionOfLargeMatrix2,
and so a copy must be made.
According to the statement above, when you directly pass a class object and
you change an


