Respondida
How to properly write an if-else-statement such that if the condition is met, then the values in x-vector will be stored in the vector; or else the values in the x-vector will not be deleted??
g = (x >= 1) & (x <= 2440); % Logical result of the elements you want to keep x(~g) = []; % Delete the others (or you could...

alrededor de 11 años hace | 1

| aceptada

Respondida
Random number gerator problem
hist(r, 1:limit); You inadvertently used randomness in your hist call, so MATLAB tried a recursive call with no arguments, ...

alrededor de 11 años hace | 0

| aceptada

Respondida
How can a MEX file give parameters to a C++ program?
In this line you are using an integer output format %i to print a floating point double value: mexPrintf("Value Read = %i\n...

alrededor de 11 años hace | 1

| aceptada

Respondida
Can someone explain this error to me?
What are the dimensions of a1 and a2, and any other variable you have in that line? If the first dimensions are not 1, they will...

alrededor de 11 años hace | 0

Respondida
Why can't I access day, juliandate?
If it is just this function you need, then you could use this instead: datenum(whatever) + 1721058.5 For day you could u...

alrededor de 11 años hace | 1

Respondida
Error Message while executing these function - Unbalanced or unexpected parenthesis or bracket
Don't use subscripts in function argument lists. I.e., don't use the (1) and (2) below: function [AA1,AA2] = distributingth...

alrededor de 11 años hace | 0

Respondida
Can somebody tell me why, when I call a function using an input, the input is disregarded?
You show code for function sensingmatrix3d, but your example is calling test3dmatrix. How are the two related? Look at how test3...

alrededor de 11 años hace | 0

| aceptada

Respondida
MEX Compiler Error....for WINDOWS 10?
See this thread: http://www.mathworks.com/matlabcentral/answers/223444-will-matlab-be-compatible-with-windows-10

alrededor de 11 años hace | 0

Respondida
parallel for loop in mex
Some Microsoft compilers support OpenMP, but I don't think the vanilla SDK compiler is one of them. Did you mean using OpenMP, o...

alrededor de 11 años hace | 0

Respondida
How to set an upper and lower limit on a data set from a matrix
Assuming you want to extract all the rows where the 3rd column meets your conditions: GalList = your matrix lower_limit ...

alrededor de 11 años hace | 1

Respondida
Index exceeds matrix dimensions. Please help.
Do you inadvertantly have a variable called "input" in your workspace?

alrededor de 11 años hace | 0

Respondida
I need help with the encryption of a 140 character message
E.g., s = 'a string'; % original string d = double(s); % string turned into numbers t = char(d); % numbers turned bac...

alrededor de 11 años hace | 0

Respondida
matlab c shared library: capturing matlab function output with mxArray*/mxArray**
It seg faults because you de-reference an uninitialized pointer with this line: *c = mxCreateDoubleMatrix(1, 1, mxREAL); ...

alrededor de 11 años hace | 0

Respondida
Selecting an entry of a row in a large matrix
b = a(3:3:end,1); % 1st element of every 3rd row a(3:3:end,:) = []; % remove every 3rd row

alrededor de 11 años hace | 0

Respondida
Issue with Mex Function
You can't re-use mxArray variables like you are doing when you are building a cell or struct array in a mex routine. There is an...

alrededor de 11 años hace | 1

| aceptada

Respondida
Mex a cpp file in MATLAB, but cannot find .h files, ubuntu 14.04
You need to find those header files. When you do, simply put them in the current directory where the cpp file is.

alrededor de 11 años hace | 0

Respondida
Matlab MEX file - index correct, incorrect UINT32 values
The input is a uint8 array, but you are using a uint32_t pointer to access the data. So there is a mismatch. Change this: u...

alrededor de 11 años hace | 1

Respondida
C mex file - sort and store index
You compIndex routine does not appear to index into the non-contiguous row data properly. You create an index array idx that ha...

alrededor de 11 años hace | 1

Respondida
Using mexw32 model in newer Matlab version
mex functions are not guaranteed to be compatible between MATLAB versions. You might get lucky or you might not. In your case, i...

alrededor de 11 años hace | 1

Respondida
How do you integrate a set of matrix equations?
Reshape them as vectors to pass into ode45. Then in your derivative routine, reshape back to matrix form to do your matrix calcu...

alrededor de 11 años hace | 0

| aceptada

Respondida
How to write a for loop to make the column calculations?
Maybe just add another loop over the columns. E.g., for c=1:4 for i=1:3 y=[Y1{i,c}'] x=[X{i,c}...

alrededor de 11 años hace | 0

| aceptada

Respondida
zero padding column of data
n = number of elements to pad with 0's x = your 200 x 1 double array x(end+1:end+n) = 0;

alrededor de 11 años hace | 0

Respondida
Reshape each row of matrix into separate matrices
You could use a cell array. E.g., mat{I} = reshape(data(I,:),16,16)

alrededor de 11 años hace | 1

| aceptada

Respondida
Returning mxArray* as void* from a C shared library
Can you create your own custom header file for this library when you load it with loadlibrary, with the (void *) for the functio...

alrededor de 11 años hace | 0

Respondida
Will converting the difference between 2 datenums to seconds contain leap seconds or not?
See these related posts: http://www.mathworks.com/matlabcentral/answers/184267-datetime-utcleapseconds-2-second-difference-ac...

alrededor de 11 años hace | 0

Respondida
Concatenating element- what the different?
E.g., [1,3,10] is a three element vector with the elements 1, 3, and 10. [1:3:10] uses the colon operator and is a four el...

alrededor de 11 años hace | 0

| aceptada

Respondida
Delete row not following pattern
Assuming the pattern in the next-to-last column must be 1-2-1-2-...etc exactly [m,n] = size(a); n1 = n - 1; expected ...

alrededor de 11 años hace | 0

| aceptada

Respondida
Shifting Elements of a Vector to the right while deleting the last number
A = [1 2 3 4 5 0 0 0] % Original vector p = 3 % index for first element to shift z = 1 % number of spots to shift n =...

alrededor de 11 años hace | 0

| aceptada

Respondida
Question about using ODE45 to solve a system of linear first order DE's using "initial" conditions specified at a later time
Call ode45 twice. Run it once to integrate backwards in time to the "initial" time you want. Then run it again to integrate forw...

alrededor de 11 años hace | 0

Respondida
How to convert a vector into a matrix using reshape ,but what should be the size that should be specified?
If it has fewer elements than originally, you can't directly reshape it into the same size original matrix. You could pad with 0...

alrededor de 11 años hace | 0

Cargar más