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

más de 12 años hace | 0

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

más de 12 años hace | 2

| aceptada

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

más de 12 años hace | 13

| aceptada

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

más de 12 años hace | 0

| aceptada

Respondida
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.'...

más de 12 años hace | 1

Respondida
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',...

casi 13 años hace | 0

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

casi 13 años hace | 0

Respondida
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) ; ...

casi 13 años hace | 0

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

casi 13 años hace | 0

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

casi 13 años hace | 0

| aceptada

Respondida
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

casi 13 años hace | 0

Respondida
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

casi 13 años hace | 1

| aceptada

Respondida
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

casi 13 años hace | 0

| aceptada

Respondida
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)...

casi 13 años hace | 2

| aceptada

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

casi 13 años hace | 0

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

casi 13 años hace | 1

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

casi 13 años hace | 1

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

casi 13 años hace | 2

| aceptada

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

casi 13 años hace | 1

| aceptada

Respondida
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, ...)? ...

casi 13 años hace | 0

| aceptada

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

casi 13 años hace | 0

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

casi 13 años hace | 1

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

casi 13 años hace | 1

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

casi 13 años hace | 1

| aceptada

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

casi 13 años hace | 0

Respondida
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#',' ')

casi 13 años hace | 0

Respondida
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

casi 13 años hace | 0

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

casi 13 años hace | 0

Cargar más