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

plus de 12 ans il y a | 0

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

plus de 12 ans il y a | 2

| A accepté

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

plus de 12 ans il y a | 13

| A accepté

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

plus de 12 ans il y a | 0

| A accepté

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

plus de 12 ans il y a | 1

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

plus de 12 ans il y a | 0

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

plus de 12 ans il y a | 0

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

plus de 12 ans il y a | 0

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

plus de 12 ans il y a | 0

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

plus de 12 ans il y a | 0

| A accepté

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

plus de 12 ans il y a | 0

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

plus de 12 ans il y a | 1

| A accepté

Réponse apportée
Hi, can someone help me generate a square matrix with all its elements one, exept its diagonal? As the following
A suggestion: M = diag(1:4)+1

plus de 12 ans il y a | 0

| A accepté

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

plus de 12 ans il y a | 2

| A accepté

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

plus de 12 ans il y a | 0

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

plus de 12 ans il y a | 1

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

plus de 12 ans il y a | 1

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

plus de 12 ans il y a | 2

| A accepté

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

plus de 12 ans il y a | 1

| A accepté

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

plus de 12 ans il y a | 0

| A accepté

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

plus de 12 ans il y a | 0

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

plus de 12 ans il y a | 1

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

plus de 12 ans il y a | 1

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

plus de 12 ans il y a | 1

| A accepté

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

plus de 12 ans il y a | 0

Réponse apportée
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#',' ')

plus de 12 ans il y a | 0

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

plus de 12 ans il y a | 0

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

plus de 12 ans il y a | 0

Charger plus