Risolto

Find the sum of all the numbers of the input vector

Find the sum of all the numbers of the input vector x. Examples: Input x = [1 2 3 5] Output y is 11 Input x ...

oltre 8 anni fa

Risolto

Make the vector [1 2 3 4 5 6 7 8 9 10]

In MATLAB, you create a vector by enclosing the elements in square brackets like so: x = [1 2 3 4] Commas are optional, s...

oltre 8 anni fa

Risolto

Times 2 - START HERE

Try out this test problem first. Given the variable x as your input, multiply it by two and put the result in y. Examples:...

oltre 8 anni fa

Risposto

How to delete cell entries with an index vector

Hi! Are you sure that b is not longer than size(1) of A? Is b really a logical vector with true or false? I have no problem i...

How to delete cell entries with an index vector

Hi! Are you sure that b is not longer than size(1) of A? Is b really a logical vector with true or false? I have no problem i...

oltre 9 anni fa | 0

Risposto

check if numbers exist in a structure field

Hi! You may write m = [files(1,1).day(:).median]; to get a vector of all values in 'day'. Then you can use ismember/...

check if numbers exist in a structure field

Hi! You may write m = [files(1,1).day(:).median]; to get a vector of all values in 'day'. Then you can use ismember/...

oltre 9 anni fa | 0

Risposto

Convert Char to Cell

Hi! It seems you want to do: ListCell = num2cell(List); NewCol = size(List, 2) + 1; for n = 1:size(Table, ...

Convert Char to Cell

Hi! It seems you want to do: ListCell = num2cell(List); NewCol = size(List, 2) + 1; for n = 1:size(Table, ...

oltre 9 anni fa | 0

| accettato

Risposto

Create string of dots characters

Use repmat: repmat('.', 1, 10)

Create string of dots characters

Use repmat: repmat('.', 1, 10)

oltre 9 anni fa | 1

| accettato

Risposto

Can I use a for loop in the condition statement of an if branch??

Can you give an example? As far as I understand you have some values in your array that must match some condition. You may write...

Can I use a for loop in the condition statement of an if branch??

Can you give an example? As far as I understand you have some values in your array that must match some condition. You may write...

oltre 9 anni fa | 0

Risposto

optimize inefficient piece of code

Hi! You can of course avoid the loop with p3(1:3, ind==1) = p1(:, ind==1); p3(1:3, ind==2) = p2(:, ind==2); This a...

optimize inefficient piece of code

Hi! You can of course avoid the loop with p3(1:3, ind==1) = p1(:, ind==1); p3(1:3, ind==2) = p2(:, ind==2); This a...

oltre 9 anni fa | 0

| accettato

Risposto

Save data from a loop with a negative variable

Hi! Make a table like tt = -5:5; Access your variable with index -3 like V(tt==-3) PS: you should not dou...

Save data from a loop with a negative variable

Hi! Make a table like tt = -5:5; Access your variable with index -3 like V(tt==-3) PS: you should not dou...

quasi 10 anni fa | 0

Risposto

Plot the streamlines and pressure for flow around a rotating cylinder

Hi! Please use the code formatting for pasting code, thanks! And what is the question? What did you do? Where does the cod...

Plot the streamlines and pressure for flow around a rotating cylinder

Hi! Please use the code formatting for pasting code, thanks! And what is the question? What did you do? Where does the cod...

quasi 10 anni fa | 0

Risposto

Creating a polyval function

Hi! But you can use polyval with just p and x!

Creating a polyval function

Hi! But you can use polyval with just p and x!

quasi 10 anni fa | 2

| accettato

Risposto

How to calculate the average without taking zeros values?

Hi! for n = 1:size(Y, 1) Average(n) = mean(Y(n, (Y(n, :) ~= 0))); end

How to calculate the average without taking zeros values?

Hi! for n = 1:size(Y, 1) Average(n) = mean(Y(n, (Y(n, :) ~= 0))); end

quasi 10 anni fa | 0

Risposto

Selecting only some rows of a matrix

Hi! So, what is "i"? Did you mean ":"? I assume ":" here. Start by looking at the first criterion, you can write crit...

Selecting only some rows of a matrix

Hi! So, what is "i"? Did you mean ":"? I assume ":" here. Start by looking at the first criterion, you can write crit...

quasi 10 anni fa | 0

Risposto

Use regexp in Matlab to return the value of a variable from a text file

Hi! Maybe there is no need for a regexp. Read in the file, separate all lines at "=" and find the desired variable in the lef...

Use regexp in Matlab to return the value of a variable from a text file

Hi! Maybe there is no need for a regexp. Read in the file, separate all lines at "=" and find the desired variable in the lef...

quasi 10 anni fa | 0

Risposto

How can i scan Column A in a matrix and if its true to have it average values in Column C

Hi! So you already imported your data into matlab? What kind of matrix do you have? Is it a cell array with strings in the fi...

How can i scan Column A in a matrix and if its true to have it average values in Column C

Hi! So you already imported your data into matlab? What kind of matrix do you have? Is it a cell array with strings in the fi...

quasi 10 anni fa | 0

| accettato

Risposto

How to plot a subset of triangles after DelaunayTri

Hi! If you have a triangulation you can of course plot specific triangles (if you know them) with TRI = dt.Triangula...

How to plot a subset of triangles after DelaunayTri

Hi! If you have a triangulation you can of course plot specific triangles (if you know them) with TRI = dt.Triangula...

quasi 10 anni fa | 1

| accettato

Risposto

How can I transform a number to string with space using num2str?

Hi! Maybe this way? num = [1000; 1001]; % numeric part numpart = arrayfun(@(x) sprintf('%2d', mod(x,100)), num, 'U...

How can I transform a number to string with space using num2str?

Hi! Maybe this way? num = [1000; 1001]; % numeric part numpart = arrayfun(@(x) sprintf('%2d', mod(x,100)), num, 'U...

quasi 10 anni fa | 0

| accettato

Risposto

Activate radio button from another radio button

Hi! Usually the first argument is the handle to the object whose callback you are calling. You can get this from <http://www....

Activate radio button from another radio button

Hi! Usually the first argument is the handle to the object whose callback you are calling. You can get this from <http://www....

quasi 10 anni fa | 0

| accettato

Risposto

A game like "simon"

Hi! Some hints to get you started: * You can get the player's name using "input". * Make a loop from 1 to, let's say, 100...

A game like "simon"

Hi! Some hints to get you started: * You can get the player's name using "input". * Make a loop from 1 to, let's say, 100...

quasi 10 anni fa | 0

Risposto

MATLAB Data from loop not saved

Hi! You can not use doubles as indices. Do instead: Res_E = logspace(0,2,100); for B = 1:length(Res_E); Tens =...

MATLAB Data from loop not saved

Hi! You can not use doubles as indices. Do instead: Res_E = logspace(0,2,100); for B = 1:length(Res_E); Tens =...

quasi 10 anni fa | 0

| accettato

Risposto

How to avoid setting of local directory as search path on startup?

Hi! Use the matlab startup script <http://www.mathworks.com/help/matlab/ref/matlabrc.html?searchHighlight=matlabrc matlabrc> ...

How to avoid setting of local directory as search path on startup?

Hi! Use the matlab startup script <http://www.mathworks.com/help/matlab/ref/matlabrc.html?searchHighlight=matlabrc matlabrc> ...

quasi 10 anni fa | 0

Risposto

Creating Dynamic Vector in Matlab GUI

Hi! Use a cell array for your file names (strings). Each time you upload a new image you add one cell to the array. After tha...

Creating Dynamic Vector in Matlab GUI

Hi! Use a cell array for your file names (strings). Each time you upload a new image you add one cell to the array. After tha...

quasi 10 anni fa | 0

Risposto

How to find first nonzero element/first '1' per row and set other elements to zero without loops in 3D Matrix

Hi! Why don't you want loops? It is the easiest way. Try this: ix = 1:size(A, 1); % loop over al columns for col =...

How to find first nonzero element/first '1' per row and set other elements to zero without loops in 3D Matrix

Hi! Why don't you want loops? It is the easiest way. Try this: ix = 1:size(A, 1); % loop over al columns for col =...

quasi 10 anni fa | 0

Risposto

Change color of points

Hi! Look at the help of <http://www.mathworks.com/help/matlab/ref/plot.html plot>. You may give a LineSpec there.

Change color of points

Hi! Look at the help of <http://www.mathworks.com/help/matlab/ref/plot.html plot>. You may give a LineSpec there.

quasi 10 anni fa | 0

| accettato

Risposto

Reformatting cell arrays of cell arrays

Hi! Try C{1, 1} = {'11'; '12'}; C{2, 1} = {'21'; '22'}; C{3, 1} = {'31'; '32'}; Rows = 3; Colu...

Reformatting cell arrays of cell arrays

Hi! Try C{1, 1} = {'11'; '12'}; C{2, 1} = {'21'; '22'}; C{3, 1} = {'31'; '32'}; Rows = 3; Colu...

quasi 10 anni fa | 0

| accettato