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

Answered
how can i gather points of a graph when its running a number of times?
Is this what you want: y = your vector yr = reshape(y,10,[]); result = yr(5:10,:); result = reshape(result,1,[]); ...

8 years ago | 0

Answered
How can I refer to all fields (of a particular level) within a structure?
What "works" is probably going to depend on what is contained in the sub-fields and what you intend to do with this data downstr...

8 years ago | 0

| accepted

Answered
How can I pass an array to Matlab function?
This is going to depend on whether the function in question is vectorized or not. E.g., suppose the function is vectorized: ...

8 years ago | 3

Answered
How to plot billions of points efficiently?
Another option to consider: <https://www.mathworks.com/matlabcentral/fileexchange/60289-jimhokanson-plotbig-matlab>

8 years ago | 0

Answered
Subscript indices must either be real positive integers or logicals.
Use the debugger. Type this at the MATLAB command prompt: dbstop if error Then run your code. When the error occurs, th...

8 years ago | 0

| accepted

Answered
Day_diff calculate the difference in days between two peoples birthdays in 2015?
_"... Make sure to check that the input values are of the correct types and they represent valid dates ..."_ Based on the wor...

8 years ago | 0

| accepted

Answered
I would like to use forloop for Matrix rearrange..
Either this: x = your 1x500 variable result = reshape(x,100,5).'; or result = reshape(x,5,100); Depending on ...

8 years ago | 0

| accepted

Answered
Solving an Equation 5th degree
5th order polynomials cannot be solved symbolically in general. E.g., see this: <https://en.wikipedia.org/wiki/Algebraic_solu...

8 years ago | 0

Answered
Wrong result in elipse equation
See this: <https://www.mathworks.com/matlabcentral/answers/57444-faq-why-is-0-3-0-2-0-1-not-equal-to-zero>

8 years ago | 0

| accepted

Load more