Answered
Datenum function and conversion
Yes, datenum values are in days, and there are 86400000 ms in a day. So your conversion is correct. You might be interested in...

11 years ago | 0

| accepted

Answered
Covariance, a 2x2 matrix?
The nancov function assumes you have two variables because you have two columns of data, so it returns a 2x2 covariance matrix. ...

11 years ago | 0

Answered
How Do I use Mexcallmatlab to Call a User-defined function?
I doubt you will be able to do this. Inside of mex routines, the API functions that deal with memory management are not (or at ...

11 years ago | 0

| accepted

Answered
passing by reference an object in a function
For inplace operations on data using functions, see this Blog by Loren: http://blogs.mathworks.com/loren/2007/03/22/in-place-...

11 years ago | 1

| accepted

Answered
Read binary file 3 bytes at a time
Try something like this. It reads in the entire file as uint8, groups them in 3 bytes, inserts an extra 0 byte in front of the g...

11 years ago | 0

| accepted

Answered
Vector initialized as 0:0.01:100 contains entries that are not exact
Asked and answered many times on this forum. MATLAB uses binary floating point representations of numbers. A decimal number such...

11 years ago | 0

| accepted

Answered
float input data for mex not compiling the code
If you insist on using the double bracket syntax [ ][ ] in your loopy function, then you need to realize that this is two levels...

11 years ago | 1

| accepted

Answered
Using matrix operation on a function instead of for loop
The only way to get rid of the for loop is to rewrite the function my_func to operate in a vectorized manner (assuming it doesn'...

11 years ago | 0

Answered
How to compile cpp files to make mex files using visual c++ 2010 ?
The file SFunc_Load_MsgTblC.cpp needs to be in the current directory.

11 years ago | 0

Answered
How to plot the sums of the columns in a matrix using a for loop?
plot(1:size(J,2),sum(J));

11 years ago | 0

Answered
A Differential Equations Problem
t = linspace(1,3,100); % 100 equally space points between 1 and 3

11 years ago | 0

Answered
string of binary to letters??
char(bin2dec(char(bin+'0')))'

11 years ago | 0

Answered
How to add a string to all member in matrix?
For a symbolic matrix output, e.g., n = numel(a); s = '['; for k=1:n e = ['s' num2str(a(k))]; eval(['sy...

11 years ago | 0

Answered
Unable to use syms
You need to have the Symbolic Toolbox.

11 years ago | 0

Answered
Subscripted assignment dimension mismatch.
You are using the size function to get at the number of elements, but the numel function is easier to use in this context. E.g.,...

11 years ago | 0

| accepted

Answered
I am unable to understand how to execute this code.
To answer your question literally, put the above code in a file with the extension .m, and then type the file name without the e...

11 years ago | 0

| accepted

Answered
Can you tell me if rand(1000000,1) is a uniform distribution on Matlab?
doc rand http://www.mathworks.com/help/matlab/ref/rand.html?s_tid=srchtitle rand is of course a "pseudo" uniform random ...

11 years ago | 0

Answered
ODE45 error: must return a column vector.
For a start, try changing to column vectors. E.g., Ca = (.001e-6:.01e-6:1e-6)';

11 years ago | 1

| accepted

Answered
No ifort output when mex fails to compile (Windows, 2014a, VS2013, Intel Visual Fortran 2013)
Are you compiling with the -v option?

11 years ago | 0

Answered
Can't apply an IF function with 100000*1 matrix
To make your code work, wrap a loop around it. E.g., D = zeros(size(A1)); n = numel(D); for k=1:n if A1(k) <0 ...

11 years ago | 0

| accepted

Answered
How to parameterise a function?
Do pretty much exactly what the advice says: f = @(x) x(1)^2 + 3*x(2)^2 + 4*x(3)^2 - 2*x(1)*x(2) + 5*x(1) - 3*x(2) + 2*x(3)...

11 years ago | 0

Answered
Is there any command to split the hexadecimal value automatically..
I suspect your real problem is more complicated (like you have an array of these or a cell array of these), since splitting a si...

11 years ago | 0

| accepted

Answered
Why does squeezing leading singleton dimensions produce inconsistent results
This behavior is documented: "B = squeeze(A) returns an array B with the same elements as A, but with all singleton dimension...

11 years ago | 0

Answered
How can I make a multi-variable function?
Do you mean like this? f = @(x,y,z) x.^2 + 3*y.^2 + 4*z.^2 - 2*x.*y + 5*x - 3*y + 2*z

11 years ago | 1

| accepted

Answered
Issue: MATLAB crashes running mex function at inconsistent points in function.
I haven't looked at your code in detail, but I do have a couple of comments based on a cursory look. 1) It appears to me that...

11 years ago | 0

| accepted

Answered
Read a binary file of format float
Did you open the file first to obtain a valid fID? Are you getting an error message? (If so, please post the entire message). Ar...

11 years ago | 0

Answered
Linear interpolation 4x2 matrix
>> X X = 0.9259 0.9763 2.5383 2.509 ...

11 years ago | 0

| accepted

Answered
Error in reading a dat file
How is fread supposed to know that you wrote uint32 values to the file unless you tell it? Read in the uint32 values as uint32,...

11 years ago | 0

Answered
one input in mex is not read correctly
1) A.mat contains a double precision variable, but in your argument list you have X declared as a float (single precision). Chan...

11 years ago | 0

| accepted

Answered
how to use this symbol in matlab?? ±
Did you mean a simple test for two different values? if( tht(10)==thf(10-5) || tht(10)==thf(10+5) )

11 years ago | 0

| accepted

Load more