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

más de 12 años hace | 3

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

más de 12 años hace | 0

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

más de 12 años hace | 3

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

más de 12 años hace | 0

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

más de 12 años hace | 0

| aceptada

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

más de 12 años hace | 0

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

más de 12 años hace | 0

| aceptada

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

más de 12 años hace | 0

| aceptada

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

más de 12 años hace | 0

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

más de 12 años hace | 0

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

más de 12 años hace | 0

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

más de 12 años hace | 0

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

más de 12 años hace | 1

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

más de 12 años hace | 0

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

más de 12 años hace | 0

| aceptada

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

más de 12 años hace | 0

| aceptada

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

más de 12 años hace | 1

| aceptada

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

más de 12 años hace | 0

| aceptada

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

más de 12 años hace | 0

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

más de 12 años hace | 0

| aceptada

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

más de 12 años hace | 0

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

más de 12 años hace | 0

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

más de 12 años hace | 0

| aceptada

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

más de 12 años hace | 6

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

más de 12 años hace | 0

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

más de 12 años hace | 4

| aceptada

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

más de 12 años hace | 0

Respondida
Please help me to solve this problem!
Did you check the contents of each variable?

más de 12 años hace | 0

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

más de 12 años hace | 0

| aceptada

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

más de 12 años hace | 1

Cargar más