Respondida
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(...

alrededor de 10 años hace | 1

Respondida
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...

alrededor de 10 años hace | 0

| aceptada

Respondida
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);

alrededor de 10 años hace | 0

Respondida
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...

alrededor de 10 años hace | 0

Respondida
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...

alrededor de 10 años hace | 1

| aceptada

Respondida
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,:) = []; ...

alrededor de 10 años hace | 0

| aceptada

Respondida
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...

alrededor de 10 años hace | 0

| aceptada

Respondida
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...

alrededor de 10 años hace | 2

Respondida
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....

alrededor de 10 años hace | 0

Respondida
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; ...

alrededor de 10 años hace | 1

| aceptada

Respondida
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 ...

alrededor de 10 años hace | 1

| aceptada

Respondida
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...

alrededor de 10 años hace | 0

| aceptada

Respondida
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...

alrededor de 10 años hace | 0

| aceptada

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

más de 10 años hace | 0

| aceptada

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

más de 10 años hace | 0

| aceptada

Respondida
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...

más de 10 años hace | 1

Respondida
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., ...

más de 10 años hace | 1

| aceptada

Respondida
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...

más de 10 años hace | 0

Respondida
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...

más de 10 años hace | 2

| aceptada

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

más de 10 años hace | 0

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

más de 10 años hace | 0

| aceptada

Respondida
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...

más de 10 años hace | 0

| aceptada

Respondida
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...

más de 10 años hace | 4

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

más de 10 años hace | 0

Respondida
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...

más de 10 años hace | 0

Respondida
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',...

más de 10 años hace | 1

| aceptada

Respondida
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...

más de 10 años hace | 0

Respondida
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(...

más de 10 años hace | 0

| aceptada

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

más de 10 años hace | 0

Respondida
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. ...

más de 10 años hace | 0

Cargar más