已回答
how to generate a RANDOM matrix of 0's and 1's such that the number of 1's in any column is the same.
n=6 A=zeros(n) m=2 % number of 1 per column for k=1:n idx=randperm(n,m) A(idx,k)=1 end

8 years 前 | 1

| 已接受

已回答
How to make new elements (columns) in a vector (matrix) based on the each value of this vector?
A=[4 2 3] C=ones(1,sum(A))

8 years 前 | 1

| 已接受

已回答
hi . i have n observation z1 , z2, z3 , ...... zn that is numerical value and not ordered . i need partion it to interval as following
*Edit* a=min(z) b=max(z) k =3.322*log(n) %such that k number of interval L= (max(z)-min(z))/k m=fix((b-a)/L) out=[...

8 years 前 | 0

已回答
How to combine 2 matrices (or vectors) element by element in order (with different sizes)?
A=1:3 B=4:6 C=[A;B] C=C(:)' %or C=reshape([A;B],1,[])

8 years 前 | 1

| 已接受

已回答
Problem with string assembly
V_AA = [100; 200] L_AA = length(V_AA) for i=1:L_AA F_AA{i} = sprintf('N°: %d', V_AA(i)) end %or without for loop ...

8 years 前 | 0

| 已接受

已回答
how to see a variable of a function in the Workspace?
function y=som(x,y,z) global a b a=x*y b=y^z y=a+b When you call the function som global a b y=s...

8 years 前 | 2

| 已接受

已回答
Display all the numbers of matlab
vpa(pi,40)

8 years 前 | 0

| 已接受

已回答
1e301-10^301 ~= 0 ?
Read this <http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F>

8 years 前 | 0

已回答
Array with random date find all the date belonging to the month of January using strfind.
You can use datetime function. Look at this example a={1 2 3 '01/2015';4 5 66 '01/2015';1 7 4 '02/2015'} c4=a(:,4) a=date...

8 years 前 | 0

已回答
Array with random date find all the date belonging to the month of January using strfind.
Why you don't use ismember a={1 2 3 '01/2015';4 5 66 '01/2015';1 7 4 '02/2015'} idx = ismember(a(:,4),'01/2015') .

8 years 前 | 0

已回答
How to Shorten This Logical Expression?
A = ismember(B,[1 2 3 7])

8 years 前 | 2

| 已接受

已回答
Import data 800*7 textfile into cell array using textscan
You can change your code filename = 'shipsspecs.txt'; fid = fopen(filename,'r'); if fid == -1 fprintf('Could not acc...

8 years 前 | 1

| 已接受

已回答
Import data 800*7 textfile into cell array using textscan
v=[]; for k=1:numel(ships_array) if iscell(ships_array{k}); v=[v ships_array{k}]; else v=[v num...

8 years 前 | 0

已回答
What is the difference b/w these 2 c2d options?
I found the behavior weird, but I could find the eplanation, It seems that the function c2d recognize what method to use by read...

8 years 前 | 0

已回答
Replacing the Maximum Element per Row of a Matrix with a Different Element
A=randi(100,4,5) m=max(A,[],2) A(bsxfun(@eq,A,m))=-1

8 years 前 | 0

已回答
Merging two matrices where they have the same data in 1st column
A={'01/01/16', 21, 32, 43 '03/01/16', 22, 33, 44 '05/01/16', 23, 34, 45} B={'01/01/16', 0, 0, 0 '02/01/16', 0, 0, 0 '0...

8 years 前 | 1

| 已接受

已回答
How to calculate the delta
M={1 3 'Signal' 6 1 'Offset' 3 3 5 'Deffect' 4 0 'Offset' 6 1 3 'Signal' 6 1 'Offset' 3 3 5 'Signal' 4 0 'Offset...

8 years 前 | 0

| 已接受

已回答
Finding the Frequency of Unique Values
A = [ 1 1 4 3 3 3 3 2 4 1 ] [ii,jj,kk]=unique(A) freq=accumarray(kk,1) out=[ii' freq] %or freq=hist(A,1:4)

8 years 前 | 0

| 已接受

已回答
How to download R2016a version of matlab.
Having a 2010b Release doesn't give the right to upgrade to a 2016a R, you need to pay for it

8 years 前 | 0

已回答
Detection of Falling Edge does not produce a rectangular pulse
If you have three point, false, true, false. Then you will get a triangle

8 years 前 | 0

已回答
how do i find the roots of this function? the function is attached
syms x y=x^3-x^2+5*x*sin(pi*x/4-5*pi/4)+3 solve(y) To find all the roots, you can use fsolve y=@(x) x^3-x^2+5*x*...

8 years 前 | 0

已回答
How to find the pixel information at a point whose coordinates are known ?
Im=randi(10,4) x=[1 2 3] y=[2 3 4] id=sub2ind(size(Im),x,y) pixels=Im(id)

8 years 前 | 0

已回答
changing the cell values
A = arrayfun(@(x) randi(10,1,4),1:5,'un',0) B=cellfun(@(x) strrep(x,x(3),0),A,'un',0) celldisp(B) If the cells content ar...

8 years 前 | 0

已回答
Converting a Double into a Matrix of its Digits
A = [ 123; 456; 789 ] B=num2str(A)-'0'

8 years 前 | 0

| 已接受

已回答
changing the cell values
A = arrayfun(@(x) randi(10,1,4),1:5,'un',0) % ---Example----- B=cellfun(@(x) [x(1:2) 0 x(4)],A,'un',0)

8 years 前 | 0

已回答
Converting to a Column Vector
A = [ 1 2 3; 4 5 6; 7 8 9 ] B=char(A+'0')

8 years 前 | 1

已回答
Converting to a Column Vector
A = [ 1 2 3; 4 5 6; 7 8 9 ] A*[100;10;1]

8 years 前 | 1

| 已接受

已回答
How can I store the output of a function in a seperate matrix?
for k=1:10 in_array=? % Define your in_array out_array = compute_c(in_array) M{k,1}=out_array end ...

8 years 前 | 0

已回答
Dear all; how to check if at least one array in a logical vector is true? for example: A=[0 0 0 1 0 0] and there is at least one ''1'' in this array.
A=[0 0 0 1 0 0] out=any(A) To check if theye are all equal to 1 use |all(A)|

8 years 前 | 0

已回答
What is a parameter and what is a counter in MATLAB?
Parameters are in general constants defining different kind of object. For example when you define a polynomial p=5*x^2+2*x+10 ...

8 years 前 | 1

加载更多