Respondida
How can I call MATLAB object's method from C++?
Here is some code based loosely on your singleton design, with an example run. Note that if you clear the mex routine, then the...

casi 9 años hace | 0

Respondida
Hi there, I need to correct aberrant IMU euler orientation values occurring secondary to Gimbal lock.
The code you were using was not working because the rhs yaw was not indexed. E.g., to correct this yaw(yaw>180) = yaw(yaw>...

casi 9 años hace | 0

Respondida
Matlab Engine - passing strings giving invalid characters
I don't see how this can possibly work, even when called from main( ). It appears you are writing into invalid memory. E.g., ...

casi 9 años hace | 1

Respondida
masking data of an image
You don't say what the mask is for. Here is a way to create it: mask = A < 0.02; Here is a way to use it: A(mask) ...

casi 9 años hace | 0

Respondida
Deletion of cell array element performance issue - alternative or solutions?
Keep in mind that deleting an element of a double array means: - Allocating/copying the data (64-bit doubles) to new memory &...

casi 9 años hace | 1

Respondida
Performing operation with loop index inside for-loop doesn't work as expected
You don't set the trailing elements of new_hash to spaces on each iteration, or clear new_hash each iteration, so those trailing...

casi 9 años hace | 0

| aceptada

Respondida
Help with loop error
Maybe move all of the default stuff prior to your if test. E.g., exact = NaN; approx = NaN; abs_error = NaN; ...

casi 9 años hace | 0

Respondida
What's the problem?
You can't use 3x in MATLAB ... you have to use 3*x. And you need to use the element-wise .* operator instead of the matrix mult...

casi 9 años hace | 0

Respondida
How can I get a user to assign values to a matrix A in the script window?
I don't quit follow what problem you are having. Using your code, with some additional instructions about using square brackets...

casi 9 años hace | 0

| aceptada

Respondida
pseudorandom sequence without consecutively repeating numbers
This code repeats the randperm( ) groups rather than letting the values be scattered in a more random fashion, but perhaps this ...

casi 9 años hace | 0

Respondida
Compute the first 10 Fibonacci numbers
I'm guessing your professor expects you to implement the algorithm that he/she has given you. That is, the next number is the s...

casi 9 años hace | 0

Respondida
how do i get the loop to graph properly?
Move this line i = i + 1; outside of the if test. And change this test if i==6 to this instead if k==6 ...

casi 9 años hace | 0

Respondida
EMERGENCY Cannot plot "10,000*exp(-10000*t);"
Because you used a comma to define the 10000, and MATLAB sees that comma as a statement separator. MATLAB interprets this line ...

casi 9 años hace | 1

| aceptada

Respondida
Index exceeds matrix dimensions error
Did you remember to give it a 5-element b vector, or did you inadvertently give it the old 3-element b vector? I tried your cod...

casi 9 años hace | 0

Respondida
How do I iteratively fill a large matrix within an anonymous function?
If your attempts at getting all of this logic into an anonymous function are becoming tedious and generating errors, it is time ...

casi 9 años hace | 0

| aceptada

Respondida
How do I create a new array each time there is an empty matrix in a cell array.
One way: C = your cell array x = [0, find(cellfun(@isempty,C)), numel(C)+1]; n = numel(x)-1; result = cell(1,n); ...

casi 9 años hace | 0

| aceptada

Respondida
Help with my code?
You are using t as a subscript in these lines, and one of the t values is 0: NO2(t) = (0.5./(1+(0.5)*(k)*t)); NO2_Square...

casi 9 años hace | 0

| aceptada

Respondida
Who can define a complex matrix in MATLAB? Pleale translate the FORTRAN into Matlab code?
A = bsxfun(@plus,2*(0:20)',(0:10)); B = complex(A); Same resulting matrices as Fortran, except that MATLAB indexing is...

casi 9 años hace | 0

Respondida
How to buffer old columns in a matrix when new columns are added
Append reposit this way: histoMat(end+1,1:numel(reposit)) = reposit;

casi 9 años hace | 0

| aceptada

Respondida
ndims behavior in R2016a
You have likely inadvertently created a variable called "ndims" that is shadowing the MATLAB function of the same name. Clear t...

casi 9 años hace | 1

| aceptada

Respondida
Question Regarding Division Operation
Using the ./ operator with the dot does element-wise division. Using / without the dot does matrix linear equation solving. So...

casi 9 años hace | 0

Respondida
Do I need a file "snoptmex.F90" to run SNOPT in Matlab?
You already know why you are getting the error (because it can't find any m-file or mex-file etc with that name). To fix this, ...

casi 9 años hace | 0

Respondida
How can I call MATLAB object's method from C++?
Call it just like a normal function with your Foo object as the input argument. E.g., if you have an object of class Foo at the...

casi 9 años hace | 2

| aceptada

Respondida
Diagonal Elements of the Square Matrix
Another way: M(1:size(M,1)+1:end) = 1;

casi 9 años hace | 2

Respondida
??? Error using ==> mpower Matrix must be square.
You need to use the element-wise operators that have a dot in front of them instead of the matrix operators. So use this instea...

casi 9 años hace | 0

| aceptada

Respondida
Why is the built-in dot product function somewhat inefficient?
Other than the supposition that dot() needs to be more generic for the multi-dimensional cases it must cover, the "why" is unkno...

casi 9 años hace | 1

| aceptada

Respondida
Why when comparing the class of a variable, the logical array output size differs?
Use this instead isequal(class(a),'double') or strcmp(class(a),'double') What you are doing with class(a)=='doub...

casi 9 años hace | 1

Respondida
I am supposed to write a function that takes three inputs: 1) a Coeff matrix A(nxn square mtx), right side vector b, and approximate soln' vector Xo. The function is then supposed to compute the residual vector r.
To my reading of the assignment, you are making this task more involved than it really is. The assignment states you are given ...

casi 9 años hace | 0

| aceptada

Respondida
How is this simple code read?
It is the 2nd & 3rd rows and the 2nd & 3rd columns of the matrix mat. The syntax is simply extracting a sub-matrix of the origi...

casi 9 años hace | 1

| aceptada

Respondida
loop problem with time delay
Hint: You could use tic and toc for this. Start your code with a tic statement. Then you can examine the toc result in a loop...

casi 9 años hace | 0

| aceptada

Cargar más