Answered
How to binary sum columns in a binary matrix
Just doing xor between succesive rows: r = some row number result = xor(H(r,:),H(r+1,:); Can you wrap some code around this t...

7 years ago | 1

| accepted

Answered
i want to get top right n x n matrix out of Nx N, I programmed it in following way but i got answer two times. so what is my mistake?
For "top right corner," the column indexing should not start at 1. E.g., a = N(1:n,end-n+1:end); % <-- Back off from end instea...

7 years ago | 0

Answered
Adding sparse matrices efficiently?
In general, everytime you add two sparse matrices together a bunch of sparse index sorting etc has to take place first and then ...

7 years ago | 2

| accepted

Answered
How to create an empty array in C and fill it in Matlab?
You first need to fix your memory leaks, and then also check the return pointer from engGetVariable. Maybe you are just running ...

7 years ago | 0

| accepted

Answered
How can i use the roots function to show that all the roots of a complex number lie on a square
You are really only missing one piece to get the lines plotted. To plot the lines between the points, you first need to order th...

7 years ago | 1

| accepted

Answered
MATLAB MEX Compile error
Download this matlab_version.h header file from the FEX: https://www.mathworks.com/matlabcentral/fileexchange/67016-c-mex-matla...

7 years ago | 0

Answered
Can MATLAB use a MEX Function that run continuously?
If you are willing to do everything from within the mex routine, you could gather your data iteratively in a loop and then withi...

7 years ago | 1

| accepted

Answered
How to solve this matrix?
To get a basis for the solution space: null(Q.' - eye(16)) Note that if Q.'-eye(16) is full rank then the only solution is a v...

7 years ago | 1

Answered
Cube root of a complex function
Another way is to simply use the roots( ) function with appropriate polynomial coefficients: >> roots([1 0 0 (8+3i)]) ans = ...

7 years ago | 1

Answered
function whose argument is a string containing name of respective function.
E.g., >> sind(30) ans = 0.5000 >> s = 'sind'; >> feval(s,30) ans = 0.5000 So, if you pass an argument into your ...

7 years ago | 0

Answered
generated C/C++ code from `pinv`-command gives different result than the command `pinv` itself
How much different? The MATLAB code is calling into BLAS and LAPACK library routines to accomplish this. But the Coder is not ...

7 years ago | 2

Answered
Convert long Hex String to array of uint16
Not sure exactly what you need, but here is an approach that turns a temp string of hex digits into a vector of uint16 values (4...

7 years ago | 0

| accepted

Answered
Anyway to simplify/generalise my RK4 code?
1) Define your state as a column vector, the number of elements being the number of equations that you have (since they are all ...

7 years ago | 0

Answered
Did the default rounding behaviour of num2str change between R2016b and R2018b?
The change appears to have occurred in R2017b. E.g., on Windows: >> num2strexact(1.51535) ans = '1.51534999999999...

7 years ago | 2

| accepted

Answered
How to construct a combinatorics array from two data sets with each combination having a specified number of elements?
E.g., but of course only makes sense for small sizes of your variables Set1 = [1,2,3]; Set2 = [4 5]; columns = [2 3];...

7 years ago | 0

| accepted

Answered
Coordinates of a unit vector
If I understand you correctly, simply this: point_origin = [0.284010498396800,-162.702853347011,-892.534290438801]; poin...

7 years ago | 0

| accepted

Answered
How can already used elements be eliminated one by one in 2D matrix while moving upwards? | Efficienlty
r = rot90(inputMatrix,-1); % turn rows into columns with last row as first column [~,ix] = unique(r); % get the unique line...

7 years ago | 1

| accepted

Answered
Why fix(0.05/0.05) isn't working properly in coint counting algorithm ? If I enter let's say 3.76 it gives me the correct answer,but when I enter 3.75,it gives me 9 coins..
Likely the result of floating point arithmetic. See <https://www.mathworks.com/matlabcentral/answers/57444-faq-why-is-0-3-0-2...

7 years ago | 1

Answered
Change values of a matrix if meet the condition
E.g., I think this is what you are asking for: a = your matrix of 1's and 0's p = your matrix of values (1st row corresp...

7 years ago | 0

Answered
Convert Base64 string to an image in matlab?
Maybe some variation of this: encoder = org.apache.commons.codec.binary.Base64; bytes = encoder.decode(int8(base64string...

7 years ago | 1

Answered
[matfile] how can i access mat file in c++
See this thread for information and code on how to read time series data in a mex routine: <https://www.mathworks.com/matlabc...

7 years ago | 0

Answered
How to change anonymous function to take array parameter and subject to ranges
You need to be careful with how you build your anonymous function: mu_x = @(t) f_lx(t,param); In the above line, t is an...

7 years ago | 0

| accepted

Answered
How to access elements of GF array in C++?
_"... but I'm trying to speed up my program by this C++ implementation ..."_ The MATLAB API has you hamstrung in this effort....

7 years ago | 1

| accepted

Answered
Attempted to access x(1,53); index out of bounds because size(x)=[1,2].
Type the following at the MATLAB command prompt: dbstop if error Then run your code. When the error occurs, the program ...

7 years ago | 2

Answered
How can I write the Twos complement and return a hex string ?
If you really have to write a for-loop for this, a simple algorithm for adding two 2's complement signed integers represented as...

7 years ago | 1

Answered
MEX gfortran type mismatch error
The only thing funny I see in your code at first glance are these function return type declarations: mwsize mxgetm, m...

7 years ago | 0

Answered
Why am I getting a parse error?
Please post the complete error message text, along with the offending line. I can only guess that maybe you have a variable name...

7 years ago | 0

Answered
While loop is not stopping at value.
This line yini=yini+(h*f); makes yini a vector, since f is a vector. Given that, is the following test which is operatin...

7 years ago | 0

Answered
I don't know Why my mex function associated with a Fortran 77 does not work. Can anybody help me?
1) "size" is the name of an intrinsic Fortran function that you shouldn't shadow. Pick a different name for your variable. 2)...

7 years ago | 0

| accepted

Load more