Answered
How to delete elements from a struct array?
Not exactly sure what you want to do. If you want to delete all structure elements (i.e., all fields for that element) where the...

8 years ago | 2

| accepted

Answered
Built in Julian Date Converter not working?
What version of MATLAB are you using? juliandate was introduced in R2014b. Are you using an unsupported class variable as one of...

8 years ago | 0

Answered
I want to convert a 4x1 vector column to skew symmetric matrix in matlab
You could just use the code you have already typed above. E.g., a = Q(1); b = Q(2); c = Q(3); d = Q(4); S = [0 -a d ...

8 years ago | 0

| accepted

Answered
How to get a pointer to 2D array when writing a C source Mex file?
You can't use the [j][i] indexing syntax with the pointer returned by mxGetDoubles. You would need to set up a separate pointer ...

8 years ago | 1

| accepted

Answered
Adding a singleton dimension to a 2D vector
There is no way to force a variable to physically store trailing singleton dimensions past the 2nd dimension. Operations that na...

8 years ago | 2

Answered
Why am I getting this error message?
Don't post images of code. This makes it impossible for readers to copy & paste your code for testing. Instead, post the actual ...

8 years ago | 1

| accepted

Answered
Doubt about matrices mxm
See the following link: <https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dy...

8 years ago | 0

| accepted

Answered
Why doesn't the less than operator work inside a for loop for decimals
Floating point arithmetic effects. See this link for starters: <https://www.mathworks.com/matlabcentral/answers/57444-faq-wh...

8 years ago | 2

| accepted

Answered
Exist function returning 0 for a variable that definitely exists?
Don't use exist() with struct field syntax. Only use it for variable names. E.g., >> a.f = 4 a = f: 4 >> exis...

8 years ago | 2

| accepted

Answered
How to assign a number to an array of double?
The isequal() function returns either a logical 0 or 1 depending on if the two arguments are equal. It does not return an elemen...

8 years ago | 0

| accepted

Answered
how to round the binary bit into 8 bit
Not sure what the real question is, but dec2bin has an option for minimum number of digits. E.g., >> dec2bin(1,8) ans = ...

8 years ago | 1

Answered
Everytime I run my code I keep getting an infinite recursion error. My code is posted below. Can you please help me figure out why it keeps giving me this error?
Your plot statement calls your function expapprox, so it gets into an infinite recursion. You've got another problem as well, si...

8 years ago | 0

| accepted

Answered
for-loop order
For the m-code loop itself it probably doesn't matter since the total number of iterations is the same. The stuff inside the for...

8 years ago | 1

| accepted

Answered
How to store complex data into an array using a For loop?
Type this at the MATLAB prompt: dbstop if error Then run your code. When the error occurs, the code will pause with all ...

8 years ago | 0

| accepted

Answered
Convert matrix to different row, column combinations.
B = reshape([A(:,1:2:end) A(:,2:2:end)],[],2);

8 years ago | 0

| accepted

Answered
I need help with a taylor series approximation of ln(1+x)!
This series only converges for abs(x) < 1. You are trying to use it with x = 3, which will diverge.

8 years ago | 1

Answered
Multiply two 3D arrays that result would be 4D
Assuming I understand what you are trying to do, result = permute(a,[1 4 2 3]) .* permute(b,[4 2 1 3]); or in earlier ve...

8 years ago | 0

| accepted

Answered
sum every 2 pages at a time in 3D matrix
Another way: p = 2; % number of pages at a time to sum datas = data; m = mod(size(datas,3),p); if( m ) data...

8 years ago | 1

| accepted

Answered
How to create classes in for loop?
Just use a regular for loop with indexing. E.g., for k=1:n x(k) = myclass(whatever initialization is appropriate goe...

8 years ago | 0

Answered
Is it possible to skip for loop when error appears and replace the results with NaN?
Something like this? try % your fitting stuff goes here D(p,q) = fit1.D; catch D(p,q) =...

8 years ago | 0

| accepted

Answered
How does MATLAB handle vector logic?
The doc on "if _expression_" only states that MATLAB _"... evaluates an expression ..."_ and makes no mention of any behind the ...

8 years ago | 1

| accepted

Answered
I have a 10x6x5 matrix, I want to convert it into 6x50 matrix. How to do this?
Either this: A = your 10x6x5 array result = reshape(permute(A,[2 1 3]),size(A,2),[]); Or this: A = your 10x6x5 a...

8 years ago | 1

Answered
Reshape 3d into 2d matrix (in this way)
result = reshape(A,2,[]);

8 years ago | 0

| accepted

Answered
Why do I keep getting matrix dimensions must agree?
>> size(v0) ans = 1 4 >> size(theta) ans = 1 6 So it is complaining about the v0 .* sin(th...

8 years ago | 0

| accepted

Answered
How do I change a variable in my workspace?
doc reshape E.g., X = your 1x48 vector Y = reshape(X,4,12); % <-- reshaped to a 4x12 matrix Z = Y(:); % <-- res...

8 years ago | 0

| accepted

Answered
How do I shift index and keep it as logical?
Logical values can only be 0 or 1. NaN values can only be kept in double or single class variables. You need to come up with a d...

8 years ago | 0

| accepted

Answered
Function with 2 variables
If you are passing in arguments that are vectors, then *everything* about your calculations inside the function needs to be vect...

8 years ago | 0

Answered
sparse cell array?
If you mean can the cell array itself be sparse, the answer is no to that as MATLAB only supports sparse double and logical. Wh...

8 years ago | 2

Answered
What is a time vector?
See this article for a discussion of TDT and its relationship to TAI: <https://en.wikipedia.org/wiki/Terrestrial_Time> And...

8 years ago | 0

Load more