Answered
Why do functions that call by reference not work when they are linked from other source files in a mex wrapper?
No. You still don't have it correct. I don't know what the discussion on Stack Overflow was, but the problem has nothing to do w...

10 years ago | 1

Answered
how to increment row values of a vector to form a matrix?
E.g., b = bsxfun(@plus,[0;1;2],[1 2 3 4])

10 years ago | 1

Answered
Run simulation 1000 times
Yes. Use an outer for loop. E.g., n = 1000; result = zeros(n,1); for k=1:n % your code result(k) = what...

10 years ago | 1

| accepted

Answered
Checks on Input of MEX Function Leads to Silent Failure
_"What checks do MATLAB MEX functions have on inputs that would cause this function to silently fail?"_ Not knowing what all ...

10 years ago | 0

Answered
adding values to the same column
If the loop isn't too big, you could just append it and dynamically increase the size of out in the loop. E.g., out = []; %...

10 years ago | 0

| accepted

Answered
Repeating string variables to form a new string variable
doc repmat

10 years ago | 0

Answered
Why is Stateflow Coder up-casting variables from uint8 to uint32?
In the C language, the "usual arithmetic conversions" are applied automatically to operands of many unary and binary operations,...

10 years ago | 0

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

Load more