답변 있음
what's the second variable in size function do ?
The second argument to the size function designates the particular dimension that you want. E.g., in your example, f is a 1x4. T...

8년 초과 전 | 28

| 수락됨

답변 있음
Find maximum intermediate product in matrix multiplication
Another way using a loop, which avoids the potentially large intermediate result if the dimensions happen to be large. func...

8년 초과 전 | 1

| 수락됨

답변 있음
ode numerical answer with euler-method
You do it for vectors pretty much the same way you would do it for scalars. The main difference would be that you need to accoun...

8년 초과 전 | 1

답변 있음
Remove elements from cell array
E.g., result = cellfun(@(x,y)x(~ismember(x,cell2mat(y))),array1,toRemove,'uni',false);

8년 초과 전 | 0

| 수락됨

답변 있음
Random number between 0 and the value of another variable
q = rand*(1-p);

8년 초과 전 | 1

| 수락됨

답변 있음
Matrix product along one of the dimensions of 3D array
See this link for options: <https://www.mathworks.com/matlabcentral/answers/371421-how-to-multiply-n-matrices-without-a-for-l...

8년 초과 전 | 1

답변 있음
Lotka-volterra with ode45
Problem may be stiff. Try ode15s instead.

8년 초과 전 | 0

| 수락됨

답변 있음
Error using ode45
Incorrect number of arguments for the derivative function, and incorrect syntax within that function. E.g., function y=opd...

8년 초과 전 | 0

| 수락됨

답변 있음
diag problem while substracting
It's just a display format thing. It means each number shown is actually multiplied by 1.0e-15 E.g., >> [1 2 3] ans ...

8년 초과 전 | 1

| 수락됨

답변 있음
How can I create a matrix of black and white blocks given probability p of being black or white?
E.g., result = rand(10,10) < p;

8년 초과 전 | 0

답변 있음
I want to create a binary matrix in matlab in which each element must be 4 bit. ??
Not sure what you really want. If you are looking for a character array of "bits" then you could use dec2bin. E.g., >> de...

8년 초과 전 | 0

답변 있음
Add Column Data to Existing Data Array at Specific Locations MATLAB
Going on faith that this is not homework, e.g., assuming that your ind vector has the correct number of 0's and 1's to account f...

8년 초과 전 | 1

| 수락됨

답변 있음
Disable automatic termination of mex functions
Not from within the mex function that I am aware of. When these errors occur in an API library routine, of course the routine d...

8년 초과 전 | 0

| 수락됨

답변 있음
creating a matrix where the element of the second column is smaller than the element of the first column
E.g., n = largest number (e.g., 3) result = cell2mat(arrayfun(@(x)[ones(x,1)*x,(1:x)'],1:n,'uni',false)');

8년 초과 전 | 0

답변 있음
always get 255 in sum
Variable P is likely class uint8. Assuming this is true, the summing is done as uint8 which clips at the highest value of 255 f...

8년 초과 전 | 0

| 수락됨

답변 있음
How do I find independent equations from a system of linear equations?
See this link: <https://www.mathworks.com/matlabcentral/answers/108835-how-to-get-only-linearly-independent-rows-in-a-matrix-...

8년 초과 전 | 0

답변 있음
How to create a function with multiple calculations
Create a file called triangle_area.m on your path (e.g. in your working directory) and inside that function have this code: ...

8년 초과 전 | 0

답변 있음
How can i decode(unpack) an array of bits with a constant value?
Not sure what the "rule" really is for getting the bits. Maybe one of these? x = your vector L = your number result ...

8년 초과 전 | 1

| 수락됨

답변 있음
Is it possible to use mat.h outside Matlab?
You can use it e.g. in an Engine application program as opposed to a mex routine. But even in the Engine application program yo...

8년 초과 전 | 0

답변 있음
Normalizing columns: Does my function do the same as "normc"?
Yes, your algorithm matches normc (R2016b Win64): >> m m = -0.3223 0.4342 0.2442 0.0030 -0.3323 ...

8년 초과 전 | 0

답변 있음
why calculation time become slow when I use mex file?
For linear algebra calculations, such as matrix*vector products, MATLAB actually calls a 3rd party highly optimized multi-thread...

8년 초과 전 | 1

답변 있음
Is there a way to assign a value to multiple diagonals in a matrix?
E.g., for a square matrix: >> X = zeros(6,6) X = 0 0 0 0 0 0 0 0 0 0 ...

8년 초과 전 | 2

| 수락됨

답변 있음
Solve equation of motion using ode45!
figure;plot(t,y(:,1));grid on figure;plot(t,y(:,2));grid on

8년 초과 전 | 0

| 수락됨

답변 있음
Inserting multiple columns into an existing matrix in equal distance
E.g., yellowx = reshape(yellow,[],size(red,2)); result = reshape([red;yellowx],size(red,1),[]);

8년 초과 전 | 0

| 수락됨

답변 있음
Remove columns for a cell array
Not sure what Z really is from your description. Maybe one of these will work for you: Z(:,2001:end) = []; % assumes Z is...

8년 초과 전 | 1

답변 있음
How many times does the vector change sign?
As long as there are no 0's, you could use something like this: result = numel(find(diff(sign(signal)))); If there are 0...

8년 초과 전 | 0

| 수락됨

답변 있음
How to create time series with C API?
You could use mexCallMATLAB for this. Did you want to build the object with some existing data?

8년 초과 전 | 0

답변 있음
New to matlab, need help with problem..
Good start. Thank you for posting your code. Some help: - Have the top value of your loop be 300, not 299 - Have the Tot...

8년 초과 전 | 0

답변 있음
Can one run a matlab script from the command line and pass arguments to it **without making it into a function**?
You could have your script use the getenv( ) function to retrieve all of those environment variables (as strings). Or have your...

8년 초과 전 | 0

답변 있음
how can I create help product for my function in matlab?
Put all of your help text in comments at the top of the file. E.g., here is a file called mycube.m % MYCUBE Calculates the...

8년 초과 전 | 0

더 보기