Answered
How do I shorten this code to remove one piece of information from each submatrix?
E.g., to extract the (1,1) element of each cell: A = cellfun(@(x)x(1,1),Mcell); For the (2,1) element, A = cellfun(...

10 years ago | 1

Answered
Function masking / precedence of functions
You could try the following: Run your code from a special directory that does *not* contain any of the functions you want to ma...

10 years ago | 0

| accepted

Answered
Average certain rows in 3D matrix
Is this what you want? rows = [4 5 6 9 11 17 28 38 43 50 57]; Y = mean(X(rows,:,:),1);

10 years ago | 0

Answered
How can I apply the attached vector coding equation to a matrix in matlab?
atan2d(y,x) will *not* do any difference calculations such as y(i+1)-y(i) or x(i+1)-x(i) as part of the calculation. So you woul...

10 years ago | 0

Answered
How do I solve a 3x3 matrix with 2 variables?
If you have a direction cosine matrix and want to convert it to a specific Euler Angle sequence, I would recommend this FEX subm...

10 years ago | 1

| accepted

Answered
how to delete rows from matrix
Replace your for-loop with this vectorized code: x = all(test_ary==0,2); % Which rows are all 0's test_ary(x,:) = []; ...

10 years ago | 0

| accepted

Answered
RANDOM FLIPPING FROM 1 TO -1
Make this change: : p = randperm(n); % <-- Add this line just before for-loop for k=1:n A(p(k)) = -1; % <-- ch...

10 years ago | 0

| accepted

Answered
Is it possible to get a Table from an mxArray in a MEX function?
As you have already discovered, the table class is not directly supported in the mex API. The table class is a classdef type of...

10 years ago | 2

Answered
Where to get the C++ api to read structs from MAT Files
You can find C++ API mat stuff here: http://www.mathworks.com/help/matlab/read-and-write-matlab-mat-files-in-c-c-and-fortran....

10 years ago | 0

Answered
Loop through matrix to do calculations under conditions
E.g., using a loop: A = B; for m=1:numel(A) d = B(m) - C(m); if( d > k/2 ) A(m) = A(m) - k; ...

10 years ago | 1

| accepted

Answered
Change from 1 to -1
Do you mean iteratively in a loop? E.g., changing elements one at a time in column order: n = numel(A); for k=1:n ...

10 years ago | 1

| accepted

Answered
How is the right method to declare a differential equation?
The correct method for dx(2) is method 2. You need to have values defined before they are used. Method 1 will give the wrong res...

10 years ago | 0

| accepted

Answered
Can anyone convert this Pseudocode into Matlab?
Looks like Fortran (and assuming f is an array and f_i etc are indexing into the f array). So maybe something like this, with so...

10 years ago | 0

| accepted

Answered
Hi,, I am trying to do the below problem. Any kind of help would be appreciated.TIA
X = mod(sum(A,2),2);

10 years ago | 0

| accepted

Answered
Matrix to a table
Are you just trying to concatenate them? E.g., M = [A B;C D];

10 years ago | 0

| accepted

Answered
Why do we use Q^(-1)*R*Q when convert quaternion to dcm
The Q^(-1)*v*Q is a standard convention that is widely used in industry, but I have encountered the Q*v*Q^(-1) convention as wel...

10 years ago | 1

Answered
Multidimensional matrices from Fortran to Matlab
The sum function in Fortran sums all of the elements in the array. The / operation in Fortran is an element-wise divide. I.e., ...

10 years ago | 1

| accepted

Answered
What does the dot between two variables do?
It depends on what p1 is. If p1 is a struct variable, p2 would be a field of p1. If p1 was a classdef OOP object, then p2 coul...

10 years ago | 0

Answered
Cosine function does not work
You have inadvertently created a variable with the name "cos" that is shadowing the function "cos". Clear the variable, and pic...

10 years ago | 2

| accepted

Answered
How to join two sequences in matlab?
x = [x1 x2];

10 years ago | 0

Answered
if i have this cell matrix how can delete zero cell?
z(cellfun(@isempty,z)) = [];

10 years ago | 0

| accepted

Answered
Set up all combinations of column to make several matrices?
An iterative approach: M = [A B C D]; % Your matrix of columns n = size(M,2); % Number of columns n2 = 2^n - 1; % A c...

10 years ago | 0

| accepted

Answered
2D Input Array Mex
You can't access 2D matrix values from an mxArray variable like you are doing. I.e., these lines are wrong: double ** Pro...

10 years ago | 4

Answered
get rid of empty spaces in cells containing strings
Another (slower) way: cell_sample = cellfun(@(x)x(x~=' '),cell_sample,'Uni',false)

10 years ago | 0

Answered
I'm not licensed to download any products.Where can I get the license number?
If you are looking for a student or home version, you can start with this link: http://www.mathworks.com/academia/student_ver...

10 years ago | 0

Answered
Matlab engine through C++ - Avoid the opening of the graph
Prior to calling the hist function, create the figure with the 'Visible' property set to 'Off'. E.g., f = figure('Visible',...

10 years ago | 1

| accepted

Answered
how to programme to calculate transition probability matrix?
E.g., brute force: m = max(x); n = numel(x); y = zeros(m,1); p = zeros(m,m); for k=1:n-1 y(x(k)) = y(x(k...

10 years ago | 0

Answered
Matlab crashes while running a mex function with data.
This is causing your problem: /* Make sure that the output is of type double and is a scalar */ if(!mxIsDouble(...

10 years ago | 0

| accepted

Answered
mex.h location
Why aren't you using double quotes? E.g., #include "mex.h"

10 years ago | 0

Answered
Mex file won't compile without -g option
7000 lines of code is not large at all. It is highly unlikely that your problems are related to the size of your source code. ...

10 years ago | 0

Load more