Answered
How do I combine matrices of different dimensions which are obtained in a for loop?
Do you mean something like this? result = zeros(10,11); for k=1:10 result(k,1:k+1) = 1:k+1; % or whatever the co...

9 years ago | 0

Answered
Error is compiling mex file in MATLAB with intel compiler "Intel Visual Fortran Composer XE 2013 with Microsoft Visual Studio 2010"
For a fixed format source file, the continuation line must have the continuation character in column 6. You have several lines ...

9 years ago | 0

Answered
Further improvement of matrix inversion
_How can we further speed up this inversion if we know from the beginning that Cholesky decomposition can apply in our matrix?...

9 years ago | 1

| accepted

Answered
Why can't Mex C/C++ Code With Xcode on Mac (MatlabR2015a)?
There are no spaces between the directive and the token. So change these lines #ifndef_DOUBLEIT_H_ #define_DOUBLEIT_H_ ...

9 years ago | 0

| accepted

Answered
How to merge matrices generated from a for loop into one matrix.
E.g., as a matrix of columns: solutionV = zeros(___,numel(k)); % <-- fill this in to pre-allocate : solutionV(...

9 years ago | 0

Answered
What is wrong with my code? Cycle while help
You need to break out of the loop when you hit the bottom corner. Also, you need to add in code that updates m and/or n as you ...

9 years ago | 1

| accepted

Answered
How to find which column in a matrix/array has a nonzero value?
column_number = find(x(6,:)); % <-- search the 6th row only However, why didn't the "col" variable in your attempt work ...

9 years ago | 2

| accepted

Answered
Hi evry one . Howe can i plot these ?
E.g., fixing up one operator in your equation x = -10:0.01:10; Y = (x.^2-4*x+3)./(x.^2-6*x+8); % <-- You needed to use ...

9 years ago | 2

Answered
How to only perform the upper triangular part of matrix operations?
If you can't change the looping, then maybe just insert an if-test: if( indi <= indj ) ...

9 years ago | 0

| accepted

Answered
How to call MATLAB function from Fortran 77 subroutine
See the External Interfaces API section of the doc. The Engine would be one option. Or rewriting your Fortran as a mex routine...

9 years ago | 0

Answered
while loop dose not update the variable :(
To test if vectors are not equal to each other in an if-test, using the element-wise operator ~= will produce a vector result an...

9 years ago | 0

Answered
How to generate lower triangle in a matrix where elements are the inverse of the upper traingle and diagonal is one
E.g., >> M = [0 7 9 8; 0 0 8 6; 0 0 0 4; 0 0 0 0] M = 0 7 9 8 ...

9 years ago | 0

| accepted

Answered
how can i find the error in my function please
Your current code simply returns the input as a column vector in the same order ... it does nothing to "flip" the actual element...

9 years ago | 0

Answered
Write a code using any programming language to generate 100 random variable of Rayleigh distribution.
See this link: https://www.mathworks.com/matlabcentral/answers/285394-how-to-generate-rayleigh-distributed-random-variable-wi...

9 years ago | 0

Answered
Error using * Inner matrix dimensions must agree? It also shows an error for Y, but I can't figure out what it is?
In addition to replacing appropriate * with .* and / with ./ you have an error with a t^.2 instead of a t.^2 w = 3; t = ...

9 years ago | 1

| accepted

Answered
Error using ' Transpose on ND array is not defined. Use PERMUTE instead.
Try changing this line fwrite(f, image', 'uint8'); to this (transposes the first two dimensions) fwrite(f, permute(...

9 years ago | 1

| accepted

Answered
Is it possible to get access to variables within function handles?
The only way I would be aware of would be a mex hack. E.g., c = 3; f = @(x) x + c; The "c" inside of the function ha...

9 years ago | 0

Answered
How to define a function with mexCallMatlab
I am still not entirely sure this is what you want, but here goes ... // Takes 6-element x, passes it to MATLAB function fu...

9 years ago | 1

| accepted

Answered
How to write y(n)=y(n-1)+x(n) in a way to store all values of y from n=1 to n?
There are vectorized ways to do this, but using your formula directly: y = zeros(size(x)); y(1) = something; % <-- you ...

9 years ago | 0

| accepted

Answered
Error using * Inner matrix dimensions must agree.
Maybe you need to do element-wise multiply for that calculation using the .* operator (with the dot in the front) instead of the...

9 years ago | 0

| accepted

Answered
Calculate covariance of a matrix without using cov(matrix)
Another way: MM = bsxfun(@minus,M,mean(M)); covM = MM'*MM/(size(M,1)-1);

9 years ago | 0

Answered
I have to use {} in my for loop, but now I can't multiply...
Treat the x"sub n" in the screenshot as x(n) in MATLAB. I.e., the n'th element of a vector called "x". So x"sub 1" in the sc...

9 years ago | 1

Answered
How to Save the outputs of my for loop?
rand(i) is going to create a different sized matrix for each iteration, namely a square matrix of size i x i. That's why you ar...

9 years ago | 0

| accepted

Answered
What is the best way to keep two variables synchronized?
_"... any pointer-like solutions I've seen are hacks using functions or classes derived from handles ..."_ This is really th...

9 years ago | 0

| accepted

Answered
For loop on a 3D matrix
Does this do what you want? for I = 40:60 my3Dslice = my3Darray(:,:,I); %Algorithms code end

9 years ago | 0

| accepted

Answered
What does this section of code do?
It looks like: i & j are generated as a random point on the board. dx and dy are generated as a random direction (they are...

9 years ago | 1

| accepted

Answered
Creating multiple inputs depending on conditions
Yes, there is a way, but it is a bad idea to do so. Dynamically naming variables with trailing numbers like that makes it very ...

9 years ago | 1

| accepted

Answered
Markov chain with two states using MATLAB
Assuming you want to recover the original 2x2 transition matrix from only the steady state probabilities, this is not uniquely p...

9 years ago | 0

| accepted

Answered
Problem to Threshold a Matrix
Using your small example: >> x = 2; >> y = 2; >> matrix = [ 85 99 21; 54 54 86; 57 12 13] matrix = 85 99...

9 years ago | 2

Load more