답변 있음
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년 전 | 2

| 수락됨

답변 있음
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년 전 | 0

| 수락됨

답변 있음
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년 전 | 1

답변 있음
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년 전 | 0

| 수락됨

답변 있음
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년 전 | 1

| 수락됨

답변 있음
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년 전 | 0

| 수락됨

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

거의 8년 전 | 0

| 수락됨

답변 있음
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년 전 | 1

답변 있음
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년 전 | 0

| 수락됨

답변 있음
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년 전 | 1

| 수락됨

답변 있음
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년 전 | 0

답변 있음
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년 전 | 0

| 수락됨

답변 있음
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년 전 | 1

| 수락됨

답변 있음
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년 전 | 1

답변 있음
Reshape 3d into 2d matrix (in this way)
result = reshape(A,2,[]);

거의 8년 전 | 0

| 수락됨

답변 있음
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년 전 | 0

| 수락됨

답변 있음
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년 전 | 0

| 수락됨

답변 있음
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년 전 | 0

| 수락됨

답변 있음
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,:);

거의 8년 전 | 3

| 수락됨

답변 있음
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년 전 | 0

답변 있음
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년 전 | 2

답변 있음
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년 전 | 0

답변 있음
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년 전 | 0

답변 있음
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년 전 | 0

| 수락됨

답변 있음
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년 전 | 3

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

거의 8년 전 | 0

답변 있음
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년 전 | 0

| 수락됨

답변 있음
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년 전 | 0

| 수락됨

답변 있음
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년 전 | 0

| 수락됨

답변 있음
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년 전 | 0

더 보기