I want to vectorize the following MATLAB code. I think it must be simple but I'm finding it confusing nevertheless.
r = some constant less than m or n
[m,n] = size(C);
S = zeros(m-r,n-r);
for i=1:m-r+1
for j=1:n-r+1
S(i,j) = sum(diag(C(i:i+r-1,j:j+r-1)));
end
end
The code calculates a table of scores, S, for a dynamic...
I would like to edit the axes in my series of images being displayed.
This is what my image looks like:
As you can see, it ranges from 0 to about 500 from top to bottom. Can I invert that?
Plus, I want to mirror the image being shown, so that it starts from left to right... or, if it's possible, to let the axes show from right to lef...
I would like to pass a vector of strings from C++ to matlab. I have tried using the functions available such as mxCreateCharMatrixFromStrings but it doesn't give me the correct behavior.
So, I have something like this:
void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
vector<string> stringVecto...
I'm looking for any good tutorials on vectorizing (loops) in MATLAB.
I have quite simple algorithm, but it uses two for loops. I know that it should be simple to vectorize it and I would like to learn how to do it instead of asking you for the solution.
But to let you know what problem I have, so you would be able to suggest best tuto...
Is it possible to report number of operations to evaluate for example matrix/matrix (dense or sparse) in MATLAB or octave.
...
I have a strange problem that the plot overlaps in the graph, but not in the image in the same axis.
I am sure I didn't leave hold on somewhere or else it will overlap in the image itself as well.
EDIT : I want to get rid of the blue overlapped lines, I only want one blue line to be present in that pic.
Here is a sample :
(NOTE : The...
Hi, I'm learning simulink and I want to use the rician channle block from the communications blockset. I'm told I need to change the format format. Would anyone have some sample code where they used the rician channels in simulink to model a bit error rate process?
...
I have a list that is sorted and I want to know how many values are in each bin? I made bins using linspace(floor(fist_element_list), ceil(last_element_list), num_bins) Is there a built in function or an easy way to do this in Matlab? All I can think of is doing it manually. I would like a frequency function like the one in excel.
...
I'm trying to find a way to plot a truss in MATLAB, I can do it by using an adjacency matrix and the gplot function, but its very long winded approach especially if there are a lot of nodes connected to one another. Is there a faster way to do this?
...
Perhaps this is more of a math question than a MATLAB one, not really sure. I'm using MATLAB to compute an economic model - the New Hybrid ISLM model - and there's a confusing step where the author switches the sign of the solution.
First, the author declares symbolic variables and sets up a system of difference equations. Note that the...
I have approximately 5,000 matrices with the same number of rows and varying numbers of columns (20 x ~200). Each of these matrices must be compared against every other in a dynamic programming algorithm.
In this question, I asked how to perform the comparison quickly and was given an excellent answer involving a 2D convolution. Seria...
What is the "MATLAB-way" to check if a vector only contains zeros, so that it will be evaluated to a scalar rather than to a vector. If I run this code:
vector = zeros(1,10)
%the "1" represents a function that returns a scalar
if 1 && vector == 0 %this comparision won't work
'success'
end
I get the error:
??? Operands to th...
I have a .csv file with records written in the following form:
2010-04-20 15:15:00,"8.9915176259e+00","8.8562623697e+00"
2010-04-20 15:30:00,"8.5718021723e+00","8.6633827160e+00"
2010-04-20 15:45:00,"8.4484844117e+00","8.4336586330e+00"
2010-04-20 16:00:00,"1.1106980342e+01","8.4333062208e+00"
2010-04-20 16:15:00,"9.0643470589e+00","8.6...
how is possible to add a slider to control playback of a movie made from several plots so that each step of slider show one plot(frame) of that movie?
...
I need to send a 3D .fig file to someone without access to MATLAB. I've already compiled an executable that will open a MATLAB figure, but it requires the MCR library to be installed, and the user does not have admin rights on their computer. Is there a simple program out there that can open a .fig file and allow the user to rotate/zoom/...
Is it possible to make http requests with MATLAB?
I am specifically interested in the way to make a request and store the response as a new variable.
...
How can I count the number of white pixels in a binary image with MATLAB?
...
I am attempting to typecast some data from int32 to single. I first tried using the 'Data Type Conversion' block with single output data type and the Stored Integer option. However, I found that the datatype conversion block is not typecasting the data the way I expect it to. Am I using the block incorrectly, or is it failing to work ...
The objective of skeletonization is to represent a binary image with a minimum set of pixels. The skeleton must account for geometrical properties of the form and retain associative relationships.
My question here is how can I get a skeleton from binary image?
...
I am trying to use the functionality of the reshape function available in MATLAB in Java. Are there any implementations of reshape available in Java?
...