Respondida
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 ...

alrededor de 8 años hace | 1

| aceptada

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

alrededor de 8 años hace | 0

| aceptada

Respondida
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...

alrededor de 8 años hace | 2

| aceptada

Respondida
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...

alrededor de 8 años hace | 2

| aceptada

Respondida
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...

alrededor de 8 años hace | 0

| aceptada

Respondida
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 = ...

alrededor de 8 años hace | 1

Respondida
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...

alrededor de 8 años hace | 0

| aceptada

Respondida
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...

alrededor de 8 años hace | 1

| aceptada

Respondida
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 ...

alrededor de 8 años hace | 0

| aceptada

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

alrededor de 8 años hace | 0

| aceptada

Respondida
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.

alrededor de 8 años hace | 1

Respondida
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...

alrededor de 8 años hace | 0

| aceptada

Respondida
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...

alrededor de 8 años hace | 1

| aceptada

Respondida
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...

alrededor de 8 años hace | 0

Respondida
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) =...

alrededor de 8 años hace | 0

| aceptada

Respondida
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 ...

alrededor de 8 años hace | 1

| aceptada

Respondida
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...

alrededor de 8 años hace | 1

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

alrededor de 8 años hace | 0

| aceptada

Respondida
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...

alrededor de 8 años hace | 0

| aceptada

Respondida
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...

alrededor de 8 años hace | 0

| aceptada

Respondida
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...

alrededor de 8 años hace | 0

| aceptada

Respondida
I have a table like this and I want to select only the rows where A>14 and B<1700. How to give both conditions together? Please Help.
T = your table result = T(T.A>14 & T.B<1700,:);

alrededor de 8 años hace | 3

| aceptada

Respondida
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...

alrededor de 8 años hace | 0

Respondida
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...

alrededor de 8 años hace | 2

Respondida
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...

alrededor de 8 años hace | 0

Respondida
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,[]); ...

alrededor de 8 años hace | 0

Respondida
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...

alrededor de 8 años hace | 0

| aceptada

Respondida
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: ...

alrededor de 8 años hace | 3

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

alrededor de 8 años hace | 0

Respondida
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...

alrededor de 8 años hace | 0

| aceptada

Cargar más