Answered
Simple newbie C mex question..
A few problems: *1) This code is wrong:* double *numberOfContrasts; numberOfContrasts = mxGetNumberOfElements(...

10 years ago | 1

Answered
whenever i run the program it gives error. 'Undefined function or variable 'name'.'
Please copy & paste the entire error message, showing the exact line where the problem is. From what you have posted, I would h...

10 years ago | 0

Answered
Why is my code only writing to the array 4 times?
You defined space as a double array: space = zeros(totalPoss,len); That is why it is printing as ASCII values. Try this ...

10 years ago | 0

| accepted

Answered
Combining elements in an array
Assuming you intend to combine the individual digits into a single decimal number: B = sum(A.*(10.^(numel(A)-1:-1:0))); ...

10 years ago | 2

Answered
How to delete specific lines in a table
E.g., assuming variable B is really a cell array since you stated it had mixed numeric and character data: x = ~cellfun(@is...

10 years ago | 1

Answered
Required a mathematical logic.!
E.g., using a simple loop: result = zeros(size(B)); c = B(1); % Covers the case when A(1) = 0 n = numel(B); for k=...

10 years ago | 0

| accepted

Answered
number of non-nan values across each element in n-dimensional matrix
Is this what you want? x = your 192x144x8766 array result = sum(~isnan(x),3);

10 years ago | 0

| accepted

Answered
Index exceeds Matrix dimensions
Is there a variable named patient_num in the mat file?

10 years ago | 0

Answered
how to find the index of the row
If you are looking for the closest value: x = your vector s = your scalar [~,row] = min(abs(x-s)); If you are look...

10 years ago | 0

| accepted

Answered
Fill in sequential numbers between two numbers
C = cellfun(@colon,mat2cell(A,1,ones(1,numel(A))),mat2cell(B,1,ones(1,numel(B))),'uni',false); result = [C{:}];

10 years ago | 1

Answered
Is there a way to convert FORTRAN source code into MATLAB coding without using MEX?
In general, you cannot take a compiled binary file and run it through some process to recover the original ASCII source code. Y...

10 years ago | 0

| accepted

Answered
I have an array, i want to choose randomly sub array with n bit from that how can i do it?
Assuming your binary array is a vector: b = your binary array (a vector) n = length of desired sub-array (a vector) k...

10 years ago | 0

Answered
Difference in matrix product between matlab routine and standalone app
I am not that familiar with what goes into standalone executables, but my guess is that in MATLAB that matrix multiply would be ...

10 years ago | 0

Answered
How to separate a vector into sub-vectors?
Don't do that. Use cell arrays or some other method instead. E.g., see this link: http://www.mathworks.com/matlabcentral/an...

10 years ago | 0

| accepted

Answered
apply function along dimension
Does this do what you want? % x = nD array, k = dimension to check for all NaN's per plane function result = nanplane(x,...

10 years ago | 1

| accepted

Answered
How can I send data from one function to another?
You can pass the variable out from the first function and pass it in to the other function. E.g. % File fun1.m function...

10 years ago | 1

| accepted

Answered
Function of two variable for specific values of Z?
Maybe define X and Y before you use them? [X,Y] = meshgrid(0:.2:1, 0:.2:1); Z = arrayfun(@mFunction, X, Y); surf(X,Y,...

10 years ago | 0

Answered
delete a row, or column.
Not sure if you have a 1201x1 or a 1203x1. But to delete the last row: b(end,:) = []; To retain the first 1200 rows: ...

10 years ago | 1

| accepted

Answered
How to cut an array and reshape it while keeping the content in order?
result = [T1(:,1:11);T1(:,12:22)];

10 years ago | 0

Answered
Error "Error using + Matrix dimensions must agree."
Type the following at the MATLAB command line: dbstop if error Then run your code. It will pause at the line with the e...

10 years ago | 0

Answered
How to convert a matrix of cell to type double.
if( isnumeric(X{1,end}) ) result = cell2mat(X); else result = cell2mat(X(:,1:end-1)); end

10 years ago | 0

| accepted

Answered
Hi everyone, could you please help me in Vectorization of the 3d matrix. thanks in advance
>> a a(:,:,1) = 4 5 6 1 2 3 a(:,:,2) = 0 1 2 0 7 8 ...

10 years ago | 1

| accepted

Answered
How to build a matrix with information of the comparisons between the positions of elements in an array?
You example seems to be worded backwards to me, or maybe I just don't understand the meaning of your words. In any event, you ca...

10 years ago | 0

Answered
Mex Fortran on Mac OS X El Capitan with Matlab 2016a
This message: call Hausdorff(%val(pr_out), %val(pr_in1), mG1, 1 Warning: Type mismatch in ...

10 years ago | 0

Answered
Efficiently Swapping Columns in a Matrix
Here is the mex code to swap columns in-place. Note that it is up to the user to make sure the input matrix is not shared with a...

10 years ago | 1

| accepted

Answered
How do I read an input array of type double in mex?
You almost had it correctly. But the %d format is for integer types only, not floating point. So use one of the floating point ...

10 years ago | 0

Answered
Using MATLAB to Filter Gyroscope Data
Sounds like you need to calibrate. I would recommend looking into "gyro calibration" online to get an idea of how to calibrate ...

10 years ago | 0

Answered
How can I make the "number of elements" the same?
Here you are building up TH3 elements in a loop, so TH3 will be a vector: TH3(n)=acosd((L2*cosd(TH2))/L3) And here you m...

10 years ago | 0

Answered
Does anyone have the code for the quat2euler fuction?
I would recommend the SpinCalc FEX submission by John Fuller: http://www.mathworks.com/matlabcentral/fileexchange/20696-funct...

10 years ago | 0

Answered
Can you return a matrix for all elements of vector A through vector B without a loop?
Assuming the values in A and B are consistent: n = B(1) - A(1); C = bsxfun(@plus,A,0:n);

10 years ago | 1

| accepted

Load more