已回答
Trying to Display a found answer with units
function Vtotal = tankvolume(h) rc = 10; rf = 20; hc = 30; hf = 25; if h < 0 Vtotal = -1; disp('Error h Cannot be Negati...

3 years 前 | 0

| 已接受

已回答
My program is not stop. I can not stop while command. Please help me.
Couldn't see too well as your code is a bit of a wall of text, but does l ever get updated in your loop? If not then if the expr...

3 years 前 | 0

| 已接受

已回答
Removing a column from a Matrix product in one expression
Strange as it may seem, try this C= A * B(:, 2:end) Terser is not always better, especially when things start to become confus...

3 years 前 | 0

| 已接受

已回答
How can I plot 3D graph using x,y,z data with different axis size/limit?
You say that the limits don't work - I assume you mean this doesn't work? xlim([0 30]) ylim([0 40]) zlim([0 1])

3 years 前 | 0

已回答
Making a text heading to a table with numbers
%Creat table with named fields tbl=table(3,4,5,6, 'VariableNames',{'Cats', 'Dogs', 'Ants', 'Fish'}) %Add row(s) tbl{end+1,:...

3 years 前 | 1

已回答
Error : Index exceeds the number of array elements
Y1 and X will be the same dimension as j1 - (n/2)+1 (26). Once your for loop counter hits 26 you will get an error since you are...

3 years 前 | 1

| 已接受

已回答
Meaning of the if statement
The if statement is checking that the number of columns in x (the number two in the argument of size is specifying that the fun...

3 years 前 | 1

已回答
vector with spacing (predefined)
Maybe I am missing something, but this? initial_value=-25; step_size=5; final_value=15; vector=initial_value:step_size:fin...

3 years 前 | 0

| 已接受

已回答
10x10 Matrix
a=ones(10); a(2:end,2:end)=randi([0 10],9)

3 years 前 | 0

已回答
How do I ensure the user inputs a minimum x value that's actually smaller than the maximum x value?
isError = 1; while isError user_input1 = input(['Enter the minimum and maximum values of x in',... '\nthe form ...

3 years 前 | 0

| 已接受

已回答
How do I automate breakdown of an array into smaller arrays?
for k=1:(size(r1,1)-3) v(:,:,k)=[r1(k:k+3,:)] end All 4x3 matrices will be held in v indexable by the third dimension of v

3 years 前 | 0

| 已接受

已回答
how to generate?
Consider the ASCII value for zero - the only way a computer can make sense of the subtraction is to subtract their ASCII values....

3 years 前 | 0

| 已接受

已回答
Index in position 2 exceeds array bounds (must not exceed 1).
y_v is 2001x1x2 - you are trying to index the second column which does not exist. Do you mean this? clc A= [ -0.0240 -9....

3 years 前 | 0

| 已接受

已回答
Code not working, something with while loop
The counter for the inner i loop never gets reset back to it's initial value, so it will only run on the first iteration of the ...

3 years 前 | 1

| 已接受

已回答
Why is my code a matrix and not a double
The probable source of your error is the first two conditions in the if block - they result in E_n being a 4x1 vector since e is...

3 years 前 | 0

已回答
dot in an expression
Element by element division

3 years 前 | 1

已回答
Make Y-axis show percentage of values, highest value to be set as 100%.
y = [10.6, 6.4, 5.2, 5.2, 6.3, 14.3, 19.0, 22.3, 22.5, 25.9... 26.5, 25.1, 24.3, 24.6, 23.9, 23.6, 23.2, 24.6, 22.7, 23.4.....

3 years 前 | 0

| 已接受

已回答
Return variables or elements with similar corresponding values
Essentially you would subtract a square matrix formed from the list of populations copied to form a square matrix and subtract ...

3 years 前 | 0

已回答
how do i get this to plot a graph
You are trying to plot isolated unconnected points - they can't be joined with a line so the only way you can see them is to use...

3 years 前 | 0

| 已接受

已回答
Can I fix 'Out of Memory' error by attaching an external drive?
Unfortunately a hard disk is a poor alternative to physical RAM. Whilst it is possible to get Windows to use the hard disk as vi...

3 years 前 | 1

| 已接受

已回答
Extract Values from Matrix row
You can use the logical vector to index the main array i.e A(A1)

3 years 前 | 1

| 已接受

已回答
Store variables from a loop to use later
The line in the k loop: Var = zeros(length(Answer),length(Answer)); This overwrites all values in Var with zeroes on every ite...

3 years 前 | 0

| 已接受

已回答
How to convert this ...for loop to while loop ?
i=1; while i<=5 j=1; while j<=20 amp=i*1.2; wt=j*0.05; v(i,j)=amp*sin(wt); j=j+...

3 years 前 | 1

| 已接受

已回答
How to segment one row matrix into multiple row matrix
Ultimately you can't have a matrix of the segments since they are potentially of different lengths - you could have a cell array...

3 years 前 | 0

已回答
How can I store the result after each iteration in a row vector?
A quick hack would be: Ad = [1 2]; Ac = [1 2 3 4]; As=[]; for i=1:length(Ac) for j=1:length(Ad) As=[As Ad(...

3 years 前 | 0

| 已接受

已回答
Plot doesn't show lines, only markers
In that case it would largely depend on your code, and how much effort you want to put into it (I assume this 'values' variable ...

3 years 前 | 0

已回答
Plot doesn't show lines, only markers
Take a look at the help documentation for the plot command: https://uk.mathworks.com/help/matlab/ref/plot.html There are optio...

3 years 前 | 0

| 已接受

已回答
How to build a table within an if loop without preallocation
Doubtless, you will kick yourself - but put your main table declaration outside the loop, or you'll be overwriting the old main ...

3 years 前 | 0

| 已接受

已回答
Save Monte Carlo output
Change the line ExpoStart(column)=row to ExpoStart(i,column)=row And (I think) it will do what you want. There is an argumen...

3 years 前 | 0

| 已接受

加载更多