Answered
Could anyone help me with an anonymous function trouble please?!
Make the argument of myfun a vector. E.g., myfun = @(x) ((x(1) - 2).^4 + (x(1) - 2*x(2)).^2 + (x(1).^2 - x(2)).^2); fmin...

11 years ago | 1

Answered
Multiplication - array by double, vector by double, saving to variable
What is size(amplitude{1})? t is a vector, so A*sin(f(k)*t) is a vector, which can't be assigned to a single element sins(k)....

11 years ago | 2

| accepted

Answered
how to compare two different matrix and set a counter to calculate how many rows matches with all its columns??
The above code is all commented out (begins with % and appears green in the editor). Is this the actual code you are trying to r...

11 years ago | 0

Answered
How to convert string with complex numbers to matrix
E.g. simple code assuming no blanks in the numbers, S = '5+6i 3-2i 1-i @ 4+i 2-0.2i 2.5-1.3i @' S(S=='@') = ';'; x = ...

11 years ago | 0

| accepted

Question


datetime 'UTCLeapSeconds', 2 second difference across leap sec boundary
I was recently made aware of the leap second capability in the new datetime class of R2014b, so I did some simple tests and did ...

11 years ago | 3 answers | 2

3

answers

Answered
how to use matlab garch function in C++ (using the C/C++ compiler)
The general advice here is 1) Have MATLAB call your C++ code as a mex routine, and then use the mexCallMATLAB function inside...

11 years ago | 1

| accepted

Answered
How to make a column vector of 2 distinct numbers
[ones(100,1);2*ones(300,1)]

11 years ago | 0

Answered
How to recognize multiplication with out *
Brute force loop: s = '2x + 3 - 5y'; isdigit = @(x)(x>='0'&x<='9'); s(s==' ') = []; % if you want to protect against ...

11 years ago | 0

| accepted

Answered
Why does isfield return with false when the field does exist in a structure?
It looks to me like the variable current_struct_field is a string, not a struct, so isfield will return a 0 since you didn't pas...

11 years ago | 0

Answered
unable to run due to the following error..can any one help me out in dealing with the error mentioned in the body below???
You have a function that is directly or indirectly calling itself, and there was no exit criteria reached before it called itsel...

11 years ago | 0

Answered
how to delet multiple rows with single criteria in matlab
Are you trying to delete all three H1, H2, H3 rows if any of the x values in those rows are >= 3? If so, in your example it look...

11 years ago | 0

Answered
Vector values replaced by zeros
The values in all likelihood are not exact 0's, they just display as 0's to the precision that is printed. To print more digits,...

11 years ago | 1

Answered
convert a numbere from integer to double
Your question is not clear. If the number is a scalar double and exactly 1, it will display as 1 without the trailing 0's. If it...

11 years ago | 3

Answered
Error when using openmp 'collapse' directive in matlab mex
Does your compiler support the collapse directive? What compiler are you using?

11 years ago | 1

| accepted

Answered
Segfault when trying to use std::vector in mex function
Your post suffers from the fact that you show only partial code snippets of lines, making it impossible for the reader to know e...

11 years ago | 0

Answered
How can I reorder paired points
Brute force: [~,x] = min(a(:,1)); result = zeros(size(a)); m = size(a,1); result(1,:) = a(x,:); for k=2:m ...

11 years ago | 0

Answered
Call on Dynamic Variable
Please see this post about having variables named sensor1, sensor2, sensor3, etc and then trying to process them in a loop: h...

11 years ago | 1

Answered
Intersection of two functions
You missed the pi constant when taking the derivative of sin((pi/2).*x). You only pulled out the 1/2 constant instead of the ent...

11 years ago | 0

| accepted

Answered
Assigning an opertation vector to a variable
Is this what you want? function result = myfunction(v) v(mod(v,2)~=0) = 0; result = v; return

11 years ago | 0

Answered
How to rearrange matrix elements by making last row as first row, etc?
flipud(your_matrix)

11 years ago | 4

| accepted

Answered
Could exponent of an array be inproved in speed ? Maybe mex file with exp function (reduced accuracy) for windows 64 bit.
For your particular posed example all the elements are the same, so only compute the exp calculation once and don't do all of th...

11 years ago | 1

Answered
Opposite of repmat() ? Collapse an array with repetitions
reshape(your_array(1,:,:),X,Y)'

11 years ago | 0

Answered
How do I delete a row in a matrix?
>> a = [1 3;2 0;3 11;4 8;5 0] a = 1 3 2 0 3 11 4 8 5 0 >> a(a...

11 years ago | 0

| accepted

Answered
How can I create a matrix of equal element value?
y = 121*ones(5,80);

11 years ago | 2

| accepted

Answered
How to import C++ arrays into Matlab & loop over a C++ program from within Matlab?
Thanks for posting your code. I haven't checked your indexing logic yet, but before we get into that you must first correct y...

11 years ago | 2

| accepted

Answered
How does the cycle for , if work?
The reason it doesn't produce any output is because the sum is never 0. E.g., print out S each iteration to see what is going on...

11 years ago | 0

Answered
Selecting a random question from a pool of questions until all questions are selected.
If you have n questions, then q = randperm(n); Gives you a random ordering of the numbers 1 through n. You can use that ...

11 years ago | 0

Answered
Insert a changing number into a variable in matlab?
Yes there is a way to do this using the eval function, but you will be buying a LOT of headaches with your programming in the fu...

11 years ago | 0

Answered
engEvalString not working as expected
When the project is running and paused with the "Hit return to continue" message, the Engine window should be open. Click on tha...

11 years ago | 0

Answered
Dynamically assign structure names and loop them in fuction
The result of the who command simply gives you variable names as a cell array of strings ... it doesn't give you the variables t...

11 years ago | 0

Load more