Answered
to solve the problem: Index in position 1 exceeds array bounds. Index must not exceed 10
From the error message it looks like the variable irow(i), that is the "Index in position 1" is bigger than 10, which apparently...

4 years ago | 0

| accepted

Answered
Generating a pulse signal
I like @Star Strider's approach, but as I had already coded up the approach below before I saw that, I thought I would provide t...

4 years ago | 0

Answered
Stress and deflection Equation Not Working Out
You may have other issues, but to start with you have to assign the value of the variable c before you use it at line 8

4 years ago | 0

Answered
Split an array according to a logic
If the numbers are ordered as you show them you can just use reshape() to make them into a m by 3 array. If you really need it t...

4 years ago | 0

| accepted

Answered
How do I save a figure as a png to a different directory?
x = [1 2 3] y = x.^2 plot(x,y) exportgraphics(gcf,'/Volumes/Expansion/dispersion/myplot.jpg')

4 years ago | 1

| accepted

Answered
Help me (Quadrature Rule such as newton cotes and composite)
Looks like you are somewhat on the right track. Here are some modifications that should help get you to the point that you have ...

4 years ago | 0

| accepted

Answered
Storing data from a triple for loop in a matrix
It isn't completely clear from your description, but assuming the output you want to save is the vector y from each diff eq solu...

4 years ago | 0

Answered
Simulink Stop Time from External Input
You can run simulation models programatically using the sim command. You can get the documentation for that by typing doc sim on...

4 years ago | 1

| accepted

Answered
Extracting data cell that match specific strings in different columns
If I understand your problem correctly I think you could adapt the approach I show in the simple example below % make example t...

4 years ago | 1

| accepted

Answered
Time dependent matrix entry
Under source blocks in the Simulink library there is a block called Ramp. It seems like this should work for your purpose.

4 years ago | 0

| accepted

Answered
get the position of each number
Assuming you just want the non-empty cells idx = find(~cellfun(@isempty,Msg_mmsi_selected))

4 years ago | 0

| accepted

Answered
I want to run a list of distance values through these two formulas for force and combine them into one 1x3 matrix in the form [dist force1 force2].]
You shouldn't need to use a loop for that. MATLAB can calculate the formulas directly as vectors for all of the points in DistVe...

4 years ago | 0

Answered
calculating the difference between daily precipitation values
I am not sure how you are defining "daily value differences". If you want to know the difference between succesive values you ca...

4 years ago | 1

Answered
Supplied objective function must return a scalar value - non linear regression
The objective function for fminunc must be a scalar. The function you supply to fminunc returns a vector because p is a vector, ...

4 years ago | 1

| accepted

Answered
How to split a table into multiple tables given a value of one of the columns?
Here is one approach. It seems like there might be a more elegant way to do this but I think this will do what you want. My exam...

4 years ago | 0

Answered
Why do i have the "Array indices must be positive integers or logical values" error?
Your problem is that in your loop i goes from 5 down to 1 but you index cadena2((i-1), and for the last loop when i = 1 this equ...

4 years ago | 0

| accepted

Answered
what is the problem in this code because when i use hold on command in my code but It does not work ,what is my problem ?
hold on is working but except for some NaN's which aren't plotted your functions f_1 and f_2 produce the same values as a func...

4 years ago | 1

| accepted

Answered
Defining a function for a vector of values, while keeping two variables unknown
One way to do what I think you want is to have the inner function, in your case PV(y,x,i) accept a vector argument for y and ret...

4 years ago | 0

Answered
How do I cut the signal into several parts?
You can use logical indexing. So if you wanted to remove the portion of a signal x where it equaled zero you could do something ...

4 years ago | 1

| accepted

Answered
How to locate an error in a timer callback?
I also have had a lot trouble with this. One thing that can help is to wrap the code where the problem occurs within a try catch...

4 years ago | 1

| accepted

Answered
Undefined function or variable 'para'.
This error message means that you are trying to assign the variable beta1(i) to a variable para(i,1) that you have not defined y...

5 years ago | 0

Answered
Plotting in a Loop Always Return "Vector must be the same length"
Since r is not preallocated to a 2 by 8 matrix it gets built up as it goes. The first time through your loop when you assign r(...

5 years ago | 0

Answered
how to solve ?Error using/Matrix dimensions must agree.'?
Try replacing the line assigning x2 with the following using ./ to get element by element division y2 = K./(exp((K*x-K*C2))-b);...

5 years ago | 1

| accepted

Answered
Can someone explain me how to make this loop efficiently?
I think the key is coming up with an expression that gives you the index for someArray from the current loop index. Something li...

5 years ago | 1

| accepted

Answered
Conditioning a matrix for loop
You can do this without a loop, for example out = [A(:,1:4)-b(:,1) A(:,5:8)-b(:,2) A(:,9:12)-b(:,3)] out = out - c

5 years ago | 0

| accepted

Answered
How to extract cell array data to numeric arrays or a single multidimensional array
If I understand correctly, you should be able to extract the kth individual array using something like: A = data{k}

5 years ago | 0

| accepted

Answered
Complex numbers from for loop (daisyworld model)
Without going through your code in detail (there is a lot there) I would suspect that you are raising negative values to fractio...

5 years ago | 0

| accepted

Answered
anova1: Operands to the || and && operators must be convertible to logical scalar values.
I don't think you have defined your grouping variable, second argument to anova1 correctly. According to the documentation it m...

5 years ago | 0

| accepted

Answered
Non-linear coupled ODE system of equations
As Bjorn has suggested, you must guard against values of theta where cot(theta) goes to +/- infinity, e.g. 0,pi Your code seems...

5 years ago | 0

| accepted

Answered
Matrix dimensions must agree.
In order to subtract one matrix from another they must be the same size (same number of rows and columns). The error is telling ...

5 years ago | 1

Load more