Réponse apportée
Using int64 for changing the data class
int64(x), where x is is a shorter signed or unsigned integer class, will effectively attach the appropriate number of 0 bytes to...

presque 8 ans il y a | 1

| A accepté

Réponse apportée
How to input and output variable in mex function
Some issues: b = mxGetPr(plhs[1]); d = mxGetPr(plhs[2]); The above lines crash MATLAB when you try to use...

presque 8 ans il y a | 1

| A accepté

Réponse apportée
how to do bitxor operation of two 1*255 matrix
It's not entirely clear to me what operation you really want, but if the elements of h1 and h2 represent "bits", then you could ...

presque 8 ans il y a | 0

Réponse apportée
Get x and y coordinates of motion from ode45
You've got a 4th order system (2 equations for x and y, each 2nd order --> 2 x 2 = 4), so your state vector will need to be 4 el...

presque 8 ans il y a | 2

| A accepté

Réponse apportée
Im having trouble with the forward eulers method.
A basic outline would be: dt = _____; % the step size, you fill this in n = _____: % number of steps, you fill this in x = ze...

presque 8 ans il y a | 0

Réponse apportée
speed up run time of mldivide function.
You might want to take a look at the Tim Davis Factorize FES submission: https://www.mathworks.com/matlabcentral/fileexchange...

presque 8 ans il y a | 1

Réponse apportée
MATLAB returns empty string from C-MEX file
It is hard to believe that this code did not crash MATLAB. The issues: char *code; <-- This is an uninitialized pointer .....

presque 8 ans il y a | 0

| A accepté

Réponse apportée
How do I use either "printf()" or "mexPrintf()" when either call gets me "Unknown function or variable"?
Typically use disp( ) or display( ) or fprintf( ) to display variables in the command window.

presque 8 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 8 ans il y a | 1

| A accepté

Réponse apportée
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...

presque 8 ans il y a | 0

Réponse apportée
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 ...

presque 8 ans il y a | 2

| A accepté

Réponse apportée
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 ...

presque 8 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 8 ans il y a | 1

| A accepté

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

presque 8 ans il y a | 0

Réponse apportée
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...

presque 8 ans il y a | 1

| A accepté

Réponse apportée
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...

presque 8 ans il y a | 1

Réponse apportée
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 = ...

presque 8 ans il y a | 1

Réponse apportée
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 ...

presque 8 ans il y a | 0

Réponse apportée
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 ...

presque 8 ans il y a | 2

Réponse apportée
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...

presque 8 ans il y a | 0

| A accepté

Réponse apportée
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 ...

presque 8 ans il y a | 0

Réponse apportée
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...

presque 8 ans il y a | 2

| A accepté

Réponse apportée
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];...

presque 8 ans il y a | 0

| A accepté

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

presque 8 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 8 ans il y a | 1

| A accepté

Réponse apportée
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...

presque 8 ans il y a | 1

Réponse apportée
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...

presque 8 ans il y a | 0

Réponse apportée
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...

presque 8 ans il y a | 1

Réponse apportée
[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...

presque 8 ans il y a | 0

Réponse apportée
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...

presque 8 ans il y a | 0

| A accepté

Charger plus