Answered
How to solve this error "Operands to the || and && operators must be convertible to logical scalar values." ?
You get this when one or both operands are arrays. E.g., >> [1 2 3] && [4 5 6] ??? Operands to the || and && operators m...

13 years ago | 3

| accepted

Answered
HELP....mxCallMATLAB output assignment to variable???
Try this. It works for me with some simple test code for FILLAB, my_matlab_solver, and plot_variable. I added some comments wher...

13 years ago | 1

| accepted

Answered
HELP....mxCallMATLAB output assignment to variable???
Your words from above: EDIT: I'm going to be very blunt I have a variable called "U" which is defined as follows ...

13 years ago | 1

Answered
converting vector to matrix
reshape(vec,16,8)'

13 years ago | 1

| accepted

Answered
How to make a sequence number?
n = 6; sequence = 1:n;

13 years ago | 1

| accepted

Answered
swap rows and columns of a matrix
x = [2 1 3]; A_New = A(x,x);

13 years ago | 0

| accepted

Answered
Mex cannot find tmwtypes.h, "fatal error C1083: Cannot open include file", but it is in path
As a temporary workaround, try copying tmwtypes.h to your current directory just to see if it is a directory problem.

13 years ago | 0

| accepted

Answered
Mex file crash when called second time
I have taken your code and made several corrections. By comparing side by side you should be able to tell what the errors were. ...

13 years ago | 1

Answered
How to fix this error: "Undefined function 'ellipsoiddrag' for input arguments of type 'double'."
Check that the functions are in a directory that is on the MATLAB path, or that the functions are in the current directory. It c...

13 years ago | 2

| accepted

Answered
how to calculate modulus in matlab ?
See this newsgroup thread where Bruno Luong gives advice on how to do this calculation without using the symbolic toolbox: <h...

13 years ago | 1

| accepted

Answered
Constants Improperly Initialized as Arrays
Not sure what your real problem is here. *ALL* numeric constants in MATLAB (e.g., 5, 1.3, 1.4e8, etc) are double 1x1 arrays (or ...

13 years ago | 0

| accepted

Answered
Mex large output array
You have to combine the data into one array inside the mex routine itself. Once outside the mex routine, if all you have is the ...

13 years ago | 1

| accepted

Answered
How to use reshape in specific case
For your specific example, reshape(permute(A,[1 3 2]),9,3) Alter the last two dimensions to fit your actual problem. The...

13 years ago | 0

| accepted

Answered
Mex mxGetField do loop
Get Blade using the J as the index. E.g., Blade1_pr = mxGetField(prhs(ArgNum),J,'Blade')

13 years ago | 0

| accepted

Answered
Returning and passing void pointers to mex functions
The simple answer is to encode it into a uint64 or int64 variable that can be passed around. E.g., To encode: void *vp; ...

13 years ago | 2

Answered
MEX: errors with other compiler
To get the error messages to go away you can probably do this: Line 800: Put an explicit (mxArray *) cast in the code. L...

13 years ago | 0

| accepted

Answered
Take mininum over only two dimensions of 4-d array
sub_array = array(i,j,:,:); [V X] = min(sub_array(:)); [I J K L] = ind2sub(size(sub_array),X); The minimum value in t...

13 years ago | 1

| accepted

Answered
How can I preallocate it?
GGP = cell(1,PE*AE*RE); You could move the GGP{F}=zeros(2,12) stuff outside the loop as well, but it wouldn't save you anyt...

13 years ago | 0

Answered
find out in which row an element is equal to a specific number
If you are looking for rows where any value is > 1500, then find(any(data18>1500,2)) Or if you are only interested in ro...

13 years ago | 6

| accepted

Answered
Calling MATLAB from Intel Visual Fortran Code
What you are looking to do is possible. The two general ways of going about things are: ----------------------- mex "funct...

13 years ago | 0

Answered
Please Help Me! I can't figure out why pressure comes out to be 18.77 every time. The graph only graphs volume and pressure at 18.77 atm
Elementwise division also. E.g., P = (n.*R*T)./(V-n.*b) - (n.^2*a)./(V.^2);

13 years ago | 0

Answered
can you explain for me how we can find current when gave us many resistives and one voltage??
We are not sure what your MATLAB problem really is, but here is an example: Voltage = 120; % One voltage Resistance = [1...

13 years ago | 0

Answered
what does it mean by writing [~,idx] in code?
The ~ represents an output that is discarded. It is essentially equivalent to: [dummy,idx]=min(dists); clear dummy Fo...

13 years ago | 15

| accepted

Answered
Mex: How to read filepath from matlab-function?
MATLAB stores strings as 2 bytes per "character", and they are not null terminated like in C. In your code above, filename point...

13 years ago | 1

| accepted

Answered
passing argument 2 of 'mxCreateNumericArray' from incompatible pointer type
Maybe you have inadvertantly redefined mwSize. Do you have the following statement somewhere at the top of your code? #defi...

13 years ago | 0

| accepted

Answered
How can prelocate arrays?
This method uses a shared data copy of [0 0 0] to populate the individual cell elements, so it is memory efficient: A = cel...

13 years ago | 1

| accepted

Answered
How can I get rid of stdafx.h error when compiling C++ with mex in matlab?
Is 'stdafx.h' in your current directory? In fact, is all the source code and include files in your current directory?

13 years ago | 0

| accepted

Answered
Mex: Using arguments for definition an array
Some C compilers need to have all variable declarations first, before executable statements. So try this instead: void mexF...

13 years ago | 1

| accepted

Answered
Compiling c code to mex file
If you are just using this example as a learning exercise, fine. But the example given is *not* a good way to go about things in...

13 years ago | 0

Answered
Help figuring out this Function file
Your test should be: if a<=x(k) && x(k)<=b Your original line is interpreted as follows: if (a<=x(k))<=b The fir...

13 years ago | 1

| accepted

Load more