Risposto
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...

oltre 4 anni fa | 0

| accettato

Risposto
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...

oltre 4 anni fa | 0

| accettato

Risposto
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...

oltre 4 anni fa | 0

| accettato

Risposto
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])

oltre 4 anni fa | 0

Risposto
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,:...

oltre 4 anni fa | 1

Risposto
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...

oltre 4 anni fa | 1

| accettato

Risposto
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...

oltre 4 anni fa | 1

Risposto
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...

oltre 4 anni fa | 0

| accettato

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

oltre 4 anni fa | 0

Risposto
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 ...

oltre 4 anni fa | 0

| accettato

Risposto
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

oltre 4 anni fa | 0

| accettato

Risposto
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....

oltre 4 anni fa | 0

| accettato

Risposto
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....

oltre 4 anni fa | 0

| accettato

Risposto
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 ...

oltre 4 anni fa | 1

| accettato

Risposto
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...

oltre 4 anni fa | 0

Risposto
dot in an expression
Element by element division

oltre 4 anni fa | 1

Risposto
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.....

oltre 4 anni fa | 0

| accettato

Risposto
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 ...

oltre 4 anni fa | 0

Risposto
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...

oltre 4 anni fa | 0

| accettato

Risposto
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...

oltre 4 anni fa | 1

| accettato

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

oltre 4 anni fa | 1

| accettato

Risposto
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...

oltre 4 anni fa | 0

| accettato

Risposto
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+...

oltre 4 anni fa | 1

| accettato

Risposto
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...

oltre 4 anni fa | 0

Risposto
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(...

oltre 4 anni fa | 0

| accettato

Risposto
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 ...

oltre 4 anni fa | 0

Risposto
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...

oltre 4 anni fa | 0

| accettato

Risposto
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 ...

oltre 4 anni fa | 0

| accettato

Risposto
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...

oltre 4 anni fa | 0

| accettato

Carica altro