답변 있음
intersect between the second column of cell array A (for all rows) and the first column of cell array B (for all rows)
The problem is that A{:,2} and B{:,1} are not returning arrays but instead multiple answers. So somthing like this: >> A = {1,2...

23일 전 | 0

답변 있음
Replace array elements with strings
In the example code below I show how to do it with 4 names, but you can expand it to however many names you have. names = {'Pis...

26일 전 | 0

| 수락됨

답변 있음
Output of loop is 2x1 vector
If you want to store the results of each loop in a 2 by numSteps matrix you can do this numSteps= 10000; %k steps c = 0.000001...

26일 전 | 0

| 수락됨

답변 있음
How to add some fluctuation in the flat line?
I think you can adapt the approach that I illustrate here: % generate original function with flat zone t = linspace(1970,1880)...

27일 전 | 0

| 수락됨

답변 있음
Concatenate tables with variable data types in columns
I think part of the problem is the NAN's in your files. They don't automatically get imported as MATLAB NaN's as you hope. It ju...

28일 전 | 0

답변 있음
Simulink: changing parameter mid-simulation
I would just run one simulation for 5 seconds and put in a switch as shown in the first example below. Note you could probably m...

28일 전 | 0

| 수락됨

답변 있음
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...

28일 전 | 0

| 수락됨

답변 있음
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...

29일 전 | 0

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

29일 전 | 0

답변 있음
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...

약 1달 전 | 0

| 수락됨

답변 있음
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')

약 1달 전 | 1

답변 있음
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 ...

약 1달 전 | 0

| 수락됨

답변 있음
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...

약 1달 전 | 0

답변 있음
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...

약 1달 전 | 1

| 수락됨

답변 있음
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...

약 1달 전 | 1

| 수락됨

답변 있음
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.

약 1달 전 | 0

| 수락됨

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

약 1달 전 | 0

| 수락됨

답변 있음
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...

약 1달 전 | 0

답변 있음
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...

약 1달 전 | 1

답변 있음
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, ...

약 1달 전 | 1

| 수락됨

답변 있음
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...

약 1달 전 | 0

답변 있음
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...

약 1달 전 | 0

| 수락됨

답변 있음
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...

약 1달 전 | 1

| 수락됨

답변 있음
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...

약 1달 전 | 0

답변 있음
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 ...

약 1달 전 | 0

| 수락됨

답변 있음
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...

약 1달 전 | 1

| 수락됨

답변 있음
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...

8달 전 | 0

답변 있음
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(...

9달 전 | 0

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

10달 전 | 1

| 수락됨

답변 있음
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...

10달 전 | 1

| 수락됨

더로드