답변 있음
Why are properties of unique objects referring to the same object?
What is the desired behavior of the classes you are defining? Variables derived from the handle class are _supposed_ to share pr...

대략 8년 전 | 0

답변 있음
What is the equivalent of "extractAfter" function in MATLAB R2016a?
Maybe write your own replacement. E.g. a bare bones code with very little error checking: function newStr = extractAfter_(s...

대략 8년 전 | 2

| 수락됨

답변 있음
()-indexing must appear last in an index expression.
You can't daisy-chain indexing onto the end of a function return variable. E.g., this wsys = welch( mean(tsys)(:), win ); ...

대략 8년 전 | 0

답변 있음
Dos varargout make a copy of the output variables?
To see how MATLAB returns variables from subroutines you can run the following code: function x = junkdemo(n) x = rand(n...

대략 8년 전 | 2

| 수락됨

답변 있음
What is the error in this code.
Did you mean: result = 1 + e;

대략 8년 전 | 0

답변 있음
Can we do matrix operations on a matrix that might contain NaNs in it?
You can do any operation you want with the matrix, but the NaN's will propagate through all of the calculations. That is, in ge...

대략 8년 전 | 0

답변 있음
conditional adding of elements to an array
A = your data vector n = whatever (e.g., 50) result = cell2mat(arrayfun(@(x)[repmat(n,1,floor(x/n)),rem(x,n)],A,'uni',fa...

대략 8년 전 | 0

| 수락됨

답변 있음
Creating a matrix that is more time efficient
C = 3*A - B(:); % or C = bsxfun(@minus,3*A,B(:)) C(1:n+1:end) = 5*B + A;

대략 8년 전 | 1

| 수락됨

답변 있음
How to eliminate Nan
result = the stuff you are currently doing result(isnan(result)) = [];

대략 8년 전 | 0

답변 있음
Solving equation with increasing value by multiplication
a = 2.^(1:7);

대략 8년 전 | 0

답변 있음
How to load data from one script to us to plot on another?
Put the variables you want passed as outputs of the first function and inputs to the second function.

대략 8년 전 | 0

답변 있음
returning string array from mex
String arrays are a type of classdef object. They don't have any public properties that you can get at, so at present there is N...

대략 8년 전 | 1

| 수락됨

답변 있음
Backwards/Reverse in "Direct" For Loop
for k=numel(A):-1:1 k would have the values 4, 3, 2, 1 in turn. So indexing using A(k) you would be accessing A(4), A(3), A...

대략 8년 전 | 1

답변 있음
For a value 0<i<=4 give k=1, 4<i<=8 give k=2 and so on
You don't really need the lower bounds on your tests if you have already failed the previous test. E.g., if i <= 4 k...

대략 8년 전 | 0

답변 있음
Make a vector out of all even/odd numbers from 1 to 100 using for and if
You probably have left-over variables from a previous run that you are writing into. Clear them out first. E.g., put this at the...

대략 8년 전 | 1

답변 있음
How can I write a program that indicates a number if it is integer or not?
doc floor doc ceil doc round What happens if you use one of these functions and compare the result to the original va...

대략 8년 전 | 0

답변 있음
Flip a vector using for
Because you are exchanging elements, you wind up flipping the vector twice, which gets it back to the original state. Instead, j...

대략 8년 전 | 0

답변 있음
Convert String array into Cell array
Is this the conversion you need? result = arrayfun(@(x)char(varNames(x)),1:numel(varNames),'uni',false);

대략 8년 전 | 2

| 수락됨

답변 있음
Convert days to years month and days (leap year issue)
E.g. the_date = '1900-01-01'; the_days = 10; result = datetime(the_date) + the_days; Then to get at the individual...

대략 8년 전 | 1

| 수락됨

답변 있음
What is the diffence between end and return in function ?
If the "end" you are talking about is the function end, then there is no difference. Both statements will cause a return to the ...

대략 8년 전 | 1

답변 있음
Shift left and replace the LSB bit?
bu = your char array result = bu(:,2:end); result(:,end+1) = new_bit_char; E.g., >> bu = char((rand(5,8)<0.5)+'0...

대략 8년 전 | 0

| 수락됨

답변 있음
Eulers for two degree spring system
You don't have enough equations in your code. This is a 4th order system (Two variables each as a 2nd order ODE gives 2x2 = 4 or...

대략 8년 전 | 0

| 수락됨

답변 있음
Can someone please help me with this mechanical engineering problem? Thanks so much
Maximizing profit is the same thing as minimizing cost in your case. So you can use a method that minimizes a cost function. But...

대략 8년 전 | 0

답변 있음
I am facing problem with the code which i giving below.
This looks like your initial conditions are in degrees: theta0 = [30 0]; But the code assumes the input is in radians be...

대략 8년 전 | 0

답변 있음
Using ode45 to solve matrix/vector form of state space diff eq
Trying to understand your nomenclature, and using your element ordering, here is the layout I would normally start with for a 4-...

대략 8년 전 | 0

답변 있음
How to take an average of three dimensional data?
x = your 3D matrix result = mean(reshape(x,360,720,12,5),3);

대략 8년 전 | 2

| 수락됨

답변 있음
How to check if a user input is between a certain range
Use an "if test" combined with the results of the expressions z > 0 and z < 1 (or possibley z >= 0 and z <= 1 depending on what ...

대략 8년 전 | 0

답변 있음
Accessing variables with functions in Matlab
To have a function change a variable in MATLAB, one would typically do this: x = myfunction(x); And then the body of myf...

대략 8년 전 | 0

| 수락됨

답변 있음
How to get the user to input numbers that will then go into an array?
You can use the input( ) function: <https://www.mathworks.com/help/matlab/ref/input.html?searchHighlight=input&s_tid=doc_srch...

대략 8년 전 | 0

답변 있음
how can i generate real random numbers?
See this FEX contribution by John D'Errico: <https://www.mathworks.com/matlabcentral/fileexchange/49795-randfixedlinearcombin...

대략 8년 전 | 0

| 수락됨

더 보기