Answered
How to add rows of data in a 5x5 Matrix
If you want to replace the inf values with 0 first, then A(isinf(A)) = 0;

10 years ago | 0

| accepted

Answered
How to avoid going over Realmax in calculations
You might also try reordering the calculation of each term. E.g., take the exponential series: e^x = 1 + x + x^2/2! + x^3/3! ...

10 years ago | 0

Answered
How do I fix error: Index exceeds matrix dimensions?
Try this: for i=1:24:35040 Xday(icount,:)=mean(A.data(i:(i+23),:)); % <-- Changed 24*i to i+23 icount=icount+1; e...

10 years ago | 0

Answered
Is it possible to pass pointers to MATLAB structures through a COM interface?
Not sure how you have your particular COM interface set up. But, e.g. the MATLAB Engine API connection from a C/C++ program to M...

10 years ago | 1

Answered
What does this function do in matlab?
See the link on indexing: http://www.mathworks.com/help/matlab/math/matrix-indexing.html In particular, if you supply only...

10 years ago | 0

| accepted

Answered
Delete rows from array
yi1 = your matrix yi1(10000:end,:) = [];

10 years ago | 0

| accepted

Answered
Creation of a matrix (24,72) with unit lower triangular matrix?
Try this (caution, untested): M5 = zeros(24,72); M5(:,1:3:end) = tril(ones(24,24));

10 years ago | 1

Answered
How to input data from a .bin file into a 3D array?
You could read it into a vector and then reshape. E.g., image = fread(fid, 128*128*128, '*uint16'); image = reshape(imag...

10 years ago | 1

| accepted

Answered
Apply function over all 3rd dimension
Depends on the specific function. For 'rank' you will in general need a loop so that the individual 2D matrices can be passed t...

10 years ago | 0

| accepted

Answered
use matlab to calculate euler angles from rotation matrix, and then calculate rotation matrix. Why is the input matrix different from the output one?
You can use this FEX submission by John Fuller to double check your code: http://www.mathworks.com/matlabcentral/fileexchange...

10 years ago | 0

Answered
mxCreateNumericArray: increase array size at run-time
The only way is to reallocate the data memory and copy all of the data values over to the new memory area. If you increase the s...

10 years ago | 0

| accepted

Answered
How do I change a vector from [5 3 2 5 5 4 1 2] to [1 3 4 1 1 2 5 4] switching the scale from 1-5 to 5-1?
x = [5 3 2 5 5 4 1 2]; y = 6 - x;

10 years ago | 0

| accepted

Answered
Mex file access violation
Note that the signature for mxCopyPtrToReal8 is as follows: subroutine mxCopyPtrToReal8(px, y, n) mwPointer px real*8...

10 years ago | 0

Answered
physical and logical cores
MATLAB typically will use multiple cores automatically for functions that are programmed to use them. E.g., large matrix multip...

10 years ago | 0

| accepted

Answered
MEX-based class constructors?
There is no API function for directly creating a "classdef" OOP object in mex like there is for numeric, struct, cell, etc varia...

10 years ago | 1

| accepted

Answered
How can I combine two matrix ?
Another way: [y x] = ndgrid((1:7)+7,(1:7)); z = [x(:)';y(:)']; ee = [e1 e2]; e = ee(:,z(:));

10 years ago | 0

Answered
Debug Fortran Source MEX-Files error
You only need to include fintrf.h once per file, not once per routine. You have a typo for mxCreateStructMatrix. You have ...

10 years ago | 2

| accepted

Answered
Mean of elements of array
mean_array = mean(reshape(array,10,[]));

10 years ago | 1

| accepted

Answered
Fortran MEX returns inconsistent answers with -largeArrayDims
I haven't looked at the code in detail, but one thing I did notice was the declarations for the MXGETM and MXGETN functions are ...

10 years ago | 0

| accepted

Answered
How to clear mxArray ?
You cannot re-use mxArrays as outputs from the mexCallMATLAB function. The mexCallMATLAB function *always* allocates a new mxAr...

10 years ago | 0

Answered
Invalid MEX-file, specific module could not be found
The error message 'Invalid MEX-file, specific module could not be found' often indicates that the mex routine was compiled under...

10 years ago | 0

Answered
Fastest way to multiply each block of an array with another matrix
If you have a C compiler: A = your 12 x 4 x N array; B = your 4 x 16 matrix; out = mtimesx(A,B); You can find mtim...

10 years ago | 1

| accepted

Answered
how can I create a triangle that includes 1,12,123,1234,1235
You can start with this: n = 6; for k=1:n % Fill in code here for the pattern for this iteration end So you...

10 years ago | 0

Answered
how can someone make a 1234,123,12,1 pattern in a triangle
Here is a start for you. It might be easier to construct the loop using backwards indexing. E.g., n = 6; for k=n:-1:1 ...

10 years ago | 0

| accepted

Answered
Hi all nice holiday ?
Is this what you want? It generates the random numbers, then in a loop uses the k'th sample r(k). a = 0.04; b = 0.07; ...

10 years ago | 0

| accepted

Answered
How do I create a random variable which follows the Rademacher Distribution?
One way: n = number of samples; % <-- The number of samples you want mp = [-1 1]; % <-- The two values you want as o...

10 years ago | 2

| accepted

Answered
How to resolve the "Index exceeds matrix dimensions" error ?
Type the following at the command line: dbstop if error Then run your program. When the error occurs, the program will ...

10 years ago | 0

| accepted

Answered
Reading a .mat file in c/c++
Use the mat API functions from the library (e.g., matOpen, matGetVariable, etc): http://www.mathworks.com/help/matlab/read-an...

10 years ago | 3

| accepted

Answered
Question on function variables i.e. ~
It is mainly to avoid cluttering your workspace with variables you don't need in a "neat" manner. E.g., [~,I] = max(abs(xc)...

10 years ago | 1

Answered
Matrix dimensions do not agree
My guess is you meant that division in your xinf calculation to be element-wise. E.g., change the / to ./ as follows: xinf ...

10 years ago | 0

| accepted

Load more