Réponse apportée
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...

environ 3 ans il y a | 0

| A accepté

Réponse apportée
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...

environ 3 ans il y a | 0

| A accepté

Réponse apportée
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...

environ 3 ans il y a | 0

| A accepté

Réponse apportée
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])

environ 3 ans il y a | 0

Réponse apportée
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,:...

environ 3 ans il y a | 1

Réponse apportée
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...

environ 3 ans il y a | 1

| A accepté

Réponse apportée
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...

environ 3 ans il y a | 1

Réponse apportée
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...

environ 3 ans il y a | 0

| A accepté

Réponse apportée
10x10 Matrix
a=ones(10); a(2:end,2:end)=randi([0 10],9)

environ 3 ans il y a | 0

Réponse apportée
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 ...

environ 3 ans il y a | 0

| A accepté

Réponse apportée
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

environ 3 ans il y a | 0

| A accepté

Réponse apportée
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....

environ 3 ans il y a | 0

| A accepté

Réponse apportée
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....

environ 3 ans il y a | 0

| A accepté

Réponse apportée
Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in Q (line 13) D(I,J) = D(I,J)+A(I,K).*B(K,J)
In Matlab indices start at 1 (your loops start at 0)

environ 3 ans il y a | 1

Réponse apportée
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 ...

environ 3 ans il y a | 1

| A accepté

Réponse apportée
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...

environ 3 ans il y a | 0

Réponse apportée
dot in an expression
Element by element division

environ 3 ans il y a | 1

Réponse apportée
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.....

environ 3 ans il y a | 0

| A accepté

Réponse apportée
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 ...

environ 3 ans il y a | 0

Réponse apportée
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...

environ 3 ans il y a | 0

| A accepté

Réponse apportée
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...

environ 3 ans il y a | 1

| A accepté

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

environ 3 ans il y a | 1

| A accepté

Réponse apportée
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...

environ 3 ans il y a | 0

| A accepté

Réponse apportée
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+...

environ 3 ans il y a | 1

| A accepté

Réponse apportée
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...

environ 3 ans il y a | 0

Réponse apportée
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(...

environ 3 ans il y a | 0

| A accepté

Réponse apportée
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 ...

environ 3 ans il y a | 0

Réponse apportée
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...

environ 3 ans il y a | 0

| A accepté

Réponse apportée
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 ...

environ 3 ans il y a | 0

| A accepté

Réponse apportée
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...

environ 3 ans il y a | 0

| A accepté