답변 있음
How to assign value in an array depending on the index stated in another array
Welcome to the world of indexing! Your problem: a = [2 5 9] b = [0 0 0 0 0 0 0 0 0 0]; b(a) = 1 Other interesti...

대략 12년 전 | 3

답변 있음
this program taking a long time to run and i did't get the answer also due to this problem. how can i reduce this time
The slowness is caused by the fact to you expand the matrix s and sometimes the matrix data2 in each iteration. You should preal...

대략 12년 전 | 0

답변 있음
How can I calculate the difference in time (seconds) with datetime?
You can also use the dedicated function ETIME (with DATEVEC) date1 = '2014/01/16 13:12:12' date2 = '2014/01/16 13:12:13'...

대략 12년 전 | 3

답변 있음
How to perform cancatenation of binary numbers using matlab
If the values are stored as strings (character arrays): a = '1011' , b = '0011', c = '0101' out = [a b c] % simple chara...

대략 12년 전 | 0

답변 있음
combine each entry of a cell array and a double array
So is A is a *cell array of chars*, and B is a standard array of doubles, and you want to combine it into a cell array of chars....

대략 12년 전 | 0

| 수락됨

답변 있음
Frustrating for what should be simple… What have I done wrong?
Another option with strings is to use SWITCH-CASE-END in combination with a WHILE-loop and a BREAK statement. The big advantage ...

대략 12년 전 | 0

답변 있음
minimizing a function with matrix output
You can define an error function that you minimise with fminsearch. The function obj and the arguments H12, H21, F1 and F2 shoul...

대략 12년 전 | 0

| 수락됨

답변 있음
Solving permutation/combination example with MATLAB
hints (1) start with 1 box with M balls, drawing n balls from it. This will give you the set S(n). Take a look at <http://www...

대략 12년 전 | 0

| 수락됨

답변 있음
How to generate matrix using MATLAB ?
An easy way: m = kron(eye(24),ones(1,4))

대략 12년 전 | 0

답변 있음
combine each entry of a cell array and a double array
Your talking about doubles in B? What does A1B1 mean in that case? What is A1 % Assuming all doubles A = {10 ; 11 ; 12} ...

대략 12년 전 | 0

답변 있음
Grouping a given matrix into sub matrices
Let M be your matrix with time in the first column [~, ix] = histc(M(:,1), 0:0.1:0.8) C = group2cell(M(:,2),ix) No...

대략 12년 전 | 0

답변 있음
i need help for string code
The following might give some insight a1 = 1 ; a2 = 2 ; A = {a1 a2} ; % declaration disp(A) A{1} = 10 ; % change the ...

대략 12년 전 | 0

답변 있음
How to average within bins? Indexing again...
Using ACCUMARRAY to average the values belonging to the same bin: dist = [2 4 6 9] ; duration = [3 4 10 11]; bin ...

대략 12년 전 | 1

답변 있음
how can i add 1-40,41-80, 81-120 and so on till 14000 datapoints which is in a text file?
In cases when the total number of elements is not divisible by the size of the smaller groups, and reshape cannot be used, this ...

대략 12년 전 | 0

답변 있음
print numbers in Enginering Notation
Separate the mantissa and the exponent Values = [pi ; 1.12301230123e17 ; 100000 ; 9999999999999] E = floor(log10(Value...

대략 12년 전 | 0

| 수락됨

답변 있음
How to split a matrix in different sections in a loop?
A=[ 1 2 3 1 ; 4 5 6 1 ; 2 3 4 2 ; 5 6 7 2 ; 8 9 3 2 ; 5 1 2 4 ; ...

대략 12년 전 | 0

| 수락됨

답변 있음
How to read a selected number from a string?
str = '# Source Interval: 22.99 u (ID: 2)' v = strread(str,'# Source Interval: %f%*[^\n]') % The format specifier means th...

대략 12년 전 | 1

| 수락됨

답변 있음
how to delete adjacent entries from an array
Let N be the number of items that is to be removed before and after the locations of the value V in A. (so there are 2*N+1 items...

대략 12년 전 | 0

| 수락됨

답변 있음
Is possible put a vector as a diagonal of matrix ?
A = [1 2] ; n = 3 ; B = kron(eye(n),A)

대략 12년 전 | 0

답변 있음
one line form of the follwing code
You want a one-liner? Try these: catchFolders = {'iptCatch','imtCatch','iftCatch','','junk','iitCatch'} % data catchF...

대략 12년 전 | 0

| 수락됨

답변 있음
How to divide the data of a matrix?
TIMES = DATA(:,1) ; VELS = DATA(:,2) ; TakeTheCountOfTheVelocityFunction = @(V) numel(V) ; % or whatever you mean b...

대략 12년 전 | 0

답변 있음
Save FOR loop data into a vector
Note that you can loop over elements X = [1 3 5 2 3 4 1] Y = zeros(size(X)) ; % pre-allocation makes loops faster k =...

대략 12년 전 | 0

답변 있음
Converting base 10 to base 2, dec2base help
X = dec2base(4,2) whos X % X is a character array! fprintf('%g', X) % prints out ascii codes of the string!, Simil...

대략 12년 전 | 0

| 수락됨

답변 있음
count occurrences of string in a single cell array (How many times a string appear)
A faster method and more direct method of counting using the additional output of UNIQUE: XX = {'computer', 'car', 'compute...

대략 12년 전 | 6

답변 있음
create a matrix with elements as mean values of another matrix
Just to show the many roads to Rome in MatLab's world: A = ceil(10*rand(10,4)) B = cell2mat(arrayfun(@(x) sum(A(1:x,:),1...

대략 12년 전 | 0

답변 있음
How to round the decimals?
A = [pi exp(1) 1/7] Ndecimals = 2 f = 10.^Ndecimals A = round(f*A)/f

대략 12년 전 | 4

| 수락됨

답변 있음
finding similar rows in matrices
INTERSECT or ISMEMBER come into mind: tf = ismember(C, A(ismember(A,B,'rows')), 'rows') result = C(tf,:)

대략 12년 전 | 0

답변 있음
Please help me to solve this problem!
Did you check the contents of each variable?

대략 12년 전 | 0

답변 있음
Create an array from another and find the indices.
MySet = {'S' 'V' 'SV' 'S' 'V' 'V' 'S' 'SV' 'V'} MyStr = 'V' tf = strcmp(MySet, MyStr) index = find(tf) KeepSet...

대략 12년 전 | 0

| 수락됨

답변 있음
Random integer numbers using random function
Two strings of 9 random digits between 1 and 9 each (no 0?), stored in a row cell(?) array? S = cellstr(char('0' + ceil(9*r...

대략 12년 전 | 1

더 보기