Risposto
The following three lines could be used to create a plot of the Sine function: >> a = 3; >> b = 0: pi/a: 2*pi; >> plot(b,sin(b))
If you split the commands, you might figure it out yourself a = 3 b = 0:pi/a:2*pi y = sin(b) plot(b,y,'o-') % conn...

circa 13 anni fa | 0

Risposto
Splitting a matrix by even and odd numbers
use rem to determine which list of numbers is even or odd X = [1 3 4 2 5 4 2] % hint X is the first column of your matrix ...

circa 13 anni fa | 2

| accettato

Risposto
How can I delete certain rows of a matrix based on specific column values?
This is a job for logical indexing! Note that you do not need to loop over all the lines at all Assume A is your matrix. Here...

circa 13 anni fa | 13

| accettato

Risposto
while converting any number to string with num2str() floating numbers aren't preserved.
If you carefully read the help of num2str, you will see that you can use a second argument … <http://www.mathworks.nl/help/ma...

circa 13 anni fa | 0

| accettato

Risposto
Reshaping (M,N)-matrix to (M,1)-matrix
Another trick using strings: A = [1 2 3 ; 10 11 12 ; 90 0 99] B = str2num(sprintf([repmat('%d',1,size(A,2)) ' '],A.'...

circa 13 anni fa | 1

Risposto
how to compare two cells and fetch the values ?
Use cell array of strings, so you can use all the available set functions: y = {'A','B','F'} x = {'A','BBB','C','D','E',...

circa 13 anni fa | 0

Risposto
error using subplot,index exceed numbers of subplots
A general solution that loops over the values using a separate index: x=1:1:10 value = 2:2:8 N = numel(value) fo...

circa 13 anni fa | 0

Risposto
how to compare the value of a pixel with all other pixel?
You question is a little unclear. But, see help unique M = ceil(10*rand(40,30)) % pixel image uM = unique(M) ; ...

circa 13 anni fa | 0

Risposto
Arranging two arrays in ascending order.
Use the second output of sort: A = magic(3) % unsorted values B = reshape(1:numel(A),size(A)) [sortedA,ix] = sor...

circa 13 anni fa | 0

Risposto
How to construct this vector without loop?
Here is flexible version *not* using cell2mat: n = 4 ; % user specified V = 3 ; % as in the example -> [1:V 1:2*V ... ...

circa 13 anni fa | 0

| accettato

Risposto
Adding three cells element wise using cellfun
D = cell(size(A)) ; for k=1:numel(A), D{k} = A{k}+B{k}+C{k} ; end

circa 13 anni fa | 0

Risposto
how to create a vector of consecutive numbers that skip over certain elements
Another approach: K=[0; 0; 1; 0; 0; 1; 1; 0; 0; 1] R = cumsum(K==0) R(K==1) = 0

circa 13 anni fa | 1

| accettato

Risposto
How to randomly repeat an array elements?
Here is an approach: P = [1 -1 j -j] N = 16 ; ix = ceil(numel(P)*rand(1,N)) % random indices into P Y = P(ix)...

circa 13 anni fa | 2

| accettato

Risposto
Can someone help implement the perfect shuffle function?
x = 'ABCDEFGHIJKL' m = 3 % the following line pre-allocates an output to store things in, makes things faster! y...

circa 13 anni fa | 0

Risposto
How to write this expression in matlab ? Boolean logic
you really should take a look at the logical operators & and | and ~ <http://www.mathworks.nl/help/matlab/ref/logicaloperatorse...

circa 13 anni fa | 1

Risposto
how can make a matrix from many vectors?
... and if the vectors are not of the same lengths, you can use <http://www.mathworks.com/matlabcentral/fileexchange/22909-padca...

circa 13 anni fa | 1

Risposto
How to enter multiple values for one input prompt
INPUTDLG accepts multiple inputs <http://www.mathworks.nl/help/matlab/ref/inputdlg.html>

circa 13 anni fa | 2

| accettato

Risposto
intersect(A,B) returns the data with no repetitions
I think you are looking for the second output of SORT A = [ 4 1 1 2 3] [B, ix] = sort(A, 'ascend') Now, B equals A(ix...

circa 13 anni fa | 1

| accettato

Risposto
concatenate mutiple tables by repetative process
How are these tables stored in your workspace? Do they all have an individual name (like Table1, MyOtherTable, B, DDDDD, ...)? ...

circa 13 anni fa | 0

| accettato

Risposto
intersect(A,B) returns the data with no repetitions
I do not get it. Will *same* not always be exactly *B*?

circa 13 anni fa | 0

Risposto
I think my program is complete.. What happen to this line? u(i)=sin(pi*x(i)); ??
it is still there ... Note that you can make use of the fact that matlab is all about handling matrices (i.e., lists of numbe...

circa 13 anni fa | 1

Risposto
Generate random binary matrix
Should all possibilities of such a matrix be equally likely? Then it might be very quite tricky. Here's a brute force approac...

circa 13 anni fa | 1

Risposto
problem using counter in a for loop
There are at least two issues with this code: function x = triangle(n) i = 1; for i:n-1 x(i) = i+x(i+1); % (1) BO...

circa 13 anni fa | 1

| accettato

Risposto
Shadowing built-in functions
From the release notes of ML2015a: - New built-in function xbuffer. So check all your miles and change the variable xbuffer i...

circa 13 anni fa | 0

Risposto
why is a blank ignored in strcat
This used to be my workaround for the way strcat handles spaces: strrep(strcat('AAA', '#SPACE#', 'BBB'),'#SPACE#',' ')

circa 13 anni fa | 0

Risposto
How to write this expression in matlab ? p ^ q ^ r
p^q^r p = true ; q = true ; r = false ; tf = p && q && r help and

circa 13 anni fa | 0

Risposto
How do i cut a string after an amount of values or a delimiter
Something along these lines, perhaps (untested!): % data: str = '1 2 3 4 5 6; 7 8 9 10 11 12; 13 14 15 16 17 18' TextT...

circa 13 anni fa | 0

Carica altro