回答済み
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...

12年以上 前 | 0

回答済み
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 ...

12年以上 前 | 2

| 採用済み

回答済み
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...

12年以上 前 | 13

| 採用済み

回答済み
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...

12年以上 前 | 0

| 採用済み

回答済み
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.'...

12年以上 前 | 1

回答済み
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',...

12年以上 前 | 0

回答済み
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...

12年以上 前 | 0

回答済み
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) ; ...

12年以上 前 | 0

回答済み
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...

12年以上 前 | 0

回答済み
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 ... ...

12年以上 前 | 0

| 採用済み

回答済み
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

12年以上 前 | 0

回答済み
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

12年以上 前 | 1

| 採用済み

回答済み
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

12年以上 前 | 0

| 採用済み

回答済み
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)...

12年以上 前 | 2

| 採用済み

回答済み
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...

12年以上 前 | 0

回答済み
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...

12年以上 前 | 1

回答済み
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...

12年以上 前 | 1

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

12年以上 前 | 2

| 採用済み

回答済み
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...

13年弱 前 | 1

| 採用済み

回答済み
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, ...)? ...

13年弱 前 | 0

| 採用済み

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

13年弱 前 | 0

回答済み
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...

13年弱 前 | 1

回答済み
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...

13年弱 前 | 1

回答済み
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...

13年弱 前 | 1

| 採用済み

回答済み
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...

13年弱 前 | 0

回答済み
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#',' ')

13年弱 前 | 0

回答済み
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

13年弱 前 | 0

回答済み
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...

13年弱 前 | 0

さらに読み込む