回答済み
Rename Matrix in Using String
Suppose you could somehow rename your variable to the name contained in filename. What would you do next? How would you access...

約6年 前 | 0

回答済み
Scalar max of cell array with structure
If you reshape the input first, a one-liner version of your code: peak = max(cellfun(@(x) max(abs(x.noise(:))),myCell(:))); ...

約6年 前 | 0

| 採用済み

回答済み
Sum of sequence with accuracy
exp(-x) will calculate that sum.

約6年 前 | 1

回答済み
Need help solving this problem with newtons method
To match how you are calling it, you need to switch the order of the arguments in this function handle: F = @(p, t) k*p*(L-p)-a...

約6年 前 | 0

回答済み
Operators "concatenation" ?
No. MATLAB syntax does not allow using ( ) or { } right after a function call. You could of course create a third function to d...

約6年 前 | 0

| 採用済み

回答済み
Time of sparse matrix components allocation
Every time you add even one element to a sparse matrix, it has to copy data ... perhaps all of the current data ... to make room...

約6年 前 | 0

回答済み
How to get matrix data from function ,anyone help me
Not sure what the real question is. Maybe this does what you want? function [apZ,atZ]=example(a,Z) apZ = a + Z;...

約6年 前 | 0

| 採用済み

回答済み
Order a string row based on another string row by matching each element (like the sort function does)
One way: [~,idxb] = sort(B1); [~,idxa] = sort(idxb); A1new = A1(idxa); A2new = A2(idxa);

約6年 前 | 0

回答済み
How to get multiple roots of x
How are you solving it now? Maybe you just need to feed your method different starting guesses.

約6年 前 | 0

回答済み
Future Bank Account Balance
This line overwrites your old balance vector with a scalar oldbalance = newbalance(i); Instead of keeping track of old balance...

約6年 前 | 0

| 採用済み

回答済み
How to compare elements with above and below element in a column?
Is this what you want? for T = 2:M if( abs(A(T,4) - A(T-1,4)) > 50 ) A(T,4) = 0; end end

約6年 前 | 0

| 採用済み

回答済み
How do I single out elements in a vector?
Hints: You might look at the mod( ) or rem( ) function to determine if values are even. To determine how many are even, you cou...

約6年 前 | 0

回答済み
Matlab crashes while running MEX Fortran 90 routine
Three comments: 1) You should NEVER, NEVER, NEVER pass literal integers into mex API functions. It can often be the case that ...

約6年 前 | 0

| 採用済み

回答済み
Troubles with data types: integers, doubles, scientific notation, and type casting
You are confusing integer "types" with integer "values". Integer types are int8, uint8, ... int16, uint64. Integer values a 1,...

約6年 前 | 0

回答済み
Error using * Inner matrix dimensions must agree.
Use element-wise operators (with the dot .) instead of matrix operators (without the dot .), e.g., x1= 1 - (exp(-(t/4))).*(cos(...

約6年 前 | 0

| 採用済み

回答済み
Cant Use Reshape Function with Randi or Randperm
I'm guessing you need to tell this dec2bin call that it always needs to produce 16 digits also: permboxin_temp = dec2bin(permbo...

約6年 前 | 0

回答済み
Using for loop to match generated random numbers to an input value
Since you don't know ahead of time how many tries it will take, this is best done with a while loop instead of a for loop. E.g.,...

約6年 前 | 0

| 採用済み

回答済み
How can I append a new cell onto the end of a Cell Array?
If F really is a cell array in the format you list, then just C(end+1) = F; If not, then you may have to do this: C(end+1) = ...

約6年 前 | 0

| 採用済み

回答済み
Nonscalar arrays of function handles are not allowed; use cell arrays instead.
You don't need to create an array of function handles. You just need to construct one function handle to use for that iteration....

約6年 前 | 0

| 採用済み

回答済み
Forward Euler method for Higher order differential equation
You need to think of Y as your three element column vector as you have defined. So at each step you are dealing with a column v...

約6年 前 | 1

| 採用済み

回答済み
Subscript indices must either be real positive integers or logicals while k starts from 1 .
The RK4( ) function expects to call the derivative function with the signature F(tt,y), i.e. time is the 1st argument. But your...

約6年 前 | 1

回答済み
My matrix should be symmetric but isn't by a ridiculous margin
Welcome to the world of floating point arithmetic. This is typical and not unusual behavior. https://www.mathworks.com/matlabc...

約6年 前 | 0

| 採用済み

回答済み
Plot a 100x100 grid of 1's and 0's
Another option: b = your binary matrix spy(b);

約6年 前 | 0

回答済み
“Dimensions of arrays being concatenated are not consistent”
TYpe this at the command line: dbstop if error then run your code. When the error occurs the code will pause with all current ...

約6年 前 | 0

回答済み
ODE45 randomly returns vector of length 1.
Try clearing your variables before you run the script. It could be that you are inadvertently using a variable from a previous i...

約6年 前 | 0

回答済み
Solving System of 1st Order ODEs with Euler's method
The easiest way is to treat your y as 2-element column vectors instead of scalars. E.g., % function file function [x, y] = od...

約6年 前 | 1

| 採用済み

回答済み
Cell Array, Example From Manual
The variable C is only a 2D variable having two dimensions. You have requested indexing into a third dimension with that last...

約6年 前 | 0

| 採用済み

回答済み
sum every n columns, element by element
m = your matrix n = number of columns to sum squeeze(sum(reshape(m,size(m,1),n,[]),2))

約6年 前 | 1

| 採用済み

回答済み
How do I get rid of a dimension of length 0 in a multi-dimensional array?
A variable that has a 0 dimension is an empty variable ... there is no data in it to reshape. You need to backtrack in your cod...

約6年 前 | 0

| 採用済み

回答済み
ode euler - explicit method
Add this after each figure statement hold on

約6年 前 | 0

| 採用済み

さらに読み込む