Beantwortet
hi, I want to ask a prompt i number of times and insert it into a matrix, How do I do that?
Let |a| - your array |[x,y,v,w]| b = squeeze(sum(reshape(a',2,2,[])))'; A = [b,b ./ [2521,1751]]; A = A(:,[1,3,2,4]);...

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
Comparing 2 matrix with not the same dimension
all(A(:)' ~= B(:))

mehr als 8 Jahre vor | 1

Beantwortet
Datevec problem - not able to convert string to numeric array
A = {'2017-10-16T14:39:00.221Z' '2017-10-16T14:39:02.221Z' '2017-10-16T14:39:03.221Z' '2017-10-16T14:39:04.221Z' '...

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
Join tables using all rows of a column and fulling with zeros when not found a value
T1 = readtable('20171027.xls','Range','A2:B14'); T2 = readtable('20171027.xls','Range','A16:D31'); T1.Date = datetime(T...

mehr als 8 Jahre vor | 1

| akzeptiert

Beantwortet
Please help me in coding of multidimensional array
ii = find(diag(A)) out = A(ii,ii)

mehr als 8 Jahre vor | 0

Beantwortet
Find the rth "0" in specific columns in a matrix
cols = [1 3 4 6 7]; % selected columns. num_zeros = [3,4];% The ordinal number "0" in each selected column. M_nozeros ...

mehr als 8 Jahre vor | 1

| akzeptiert

Beantwortet
How to write a for loop?
Without loops: ukk = cumsum([uk;udotreal(:)]); ukk = ukk(2:end);

mehr als 8 Jahre vor | 2

Beantwortet
How to cumulatively add consecutive ones between zeros in a logical vector
y = x(:)'; ii = accumarray(bwlabel(y(:))+1,1); y = [y,0]; y(strfind(y,[1 0])+1) = -ii(2:end); out = cumsum(y(1:end...

mehr als 8 Jahre vor | 1

| akzeptiert

Beantwortet
Save results from for loop and array function
T = readtable('file.txt'); A = varfun(@(x)mean(x,'omitnan'),T,'Group',1) out = A(:,[1,4:end]);

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
Square matrix with relationships among equal rows.
B = ~squareform(pdist(A));

mehr als 8 Jahre vor | 4

| akzeptiert

Beantwortet
How to generate random integer in the inclusive range from 1 to 10
randi([1 10],5,1)

mehr als 8 Jahre vor | 2

| akzeptiert

Beantwortet
Why do i get rid of this error using cumsum saying 'dimension argument must be positive integer scalar within indexing range?
May be so? cumu_ret_is= cumsum([d_pretbm_is,d_pretl_is,d_pret2_is,d_pret3_is])

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
How to Generate a random real number in the range (0, 20)
20*rand

mehr als 8 Jahre vor | 4

Beantwortet
How to remove zero value in my column ?
Your_array_new = Your_array(all(Your_array ~= 0,2),:);

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
find the distance from each point in matrix B to all point in matrix A
Or Dista = squeeze(sqrt(sum((A - reshape(B',1,3,[])).^2,2))); % New MATLAB Dista = squeeze(sqrt(sum(bsxfun(@minus,A,resh...

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
How can i make comparison faster
[ii,jj] = find(rd(ind,:) < r & td(ind,:) < t); gSum = sum(accumarray(ii,C(jj),[],@(x)prod(x)));

mehr als 8 Jahre vor | 0

Beantwortet
how to set value for each column?
A = randi([25 50],15,10); k = {'10','01'}; n = size(A,2); k = k(ceil(2*(1:n)/n));

mehr als 8 Jahre vor | 1

| akzeptiert

Beantwortet
How could I translate this Python code to Matlab?
N = 15; L = 10; sigma = 0.075; n_configs = 100; rejections = 0 ; x = zeros(N,n_configs); for config = 1...

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
Finding the row number with two conditions in a matrix
x=157; result=[733458;733459]; [~,g] = ismember(outData(:,1),result); ii = find(x == outData(:,2)); g(ii) = g(...

mehr als 8 Jahre vor | 1

Beantwortet
Center of mass and total mass of a matrix
tot_mass = sum(A(:)); [ii,jj] = ndgrid(1:size(A,1),1:size(A,2)); R = sum(ii(:).*A(:))/tot_mass; C = sum(jj(:).*A(:))/...

mehr als 8 Jahre vor | 3

| akzeptiert

Beantwortet
Find indices in cell array
Aw = cellfun(@(x)[x{:}]',A,'un',0); Aw = [Aw{:}]; [ii,jj] = find(Aw == -1) ; out = [jj,ii];

mehr als 8 Jahre vor | 0

Beantwortet
Subscript indices must either be real positive integers or logicals
pix1 = reshape(img(x,y,:),[],1);

mehr als 8 Jahre vor | 0

Beantwortet
Cumulative sum with a for loop
_"I need to create a program for 1^2 +2^2 +...+1000^2"_ sum((1:1000).^2) or s = 0; for ii = 1:1000 s = s ...

mehr als 8 Jahre vor | 6

| akzeptiert

Beantwortet
Summing up counts in multiple matrices
M = cat(3,A,B,C); out = squeeze(sum(M >= 3,2));

mehr als 8 Jahre vor | 0

Beantwortet
Splitapply using arrayfun or func with for loop
out = accumarray(entity(:),1:numel(g),[],@(x){cumprod([g(x(1));e(x(2:end))],1)}); out = cell2mat(out);

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
Separate date and time
a - your cell array t = datetime(a); v = datevec(t); Var1 = datetime(v(:,1:3)); Var2 = duration(v(:,4:end));

mehr als 8 Jahre vor | 1

Beantwortet
Create a cell array of mixed dimension
[b,a]

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
Why doesn't Matlab's answer to factorial(100) equal Wolfram Alpha's 100!?
factorial(sym(100))

mehr als 8 Jahre vor | 1

| akzeptiert

Beantwortet
Converting Python to Matlab
Small typo in MATLAB code in |nu2| nu2 = atan2(-(xc(k)-xp(n))*sin(theta(k))+(yc(k)-yp(n))*cos(theta(n))+(xp(n+1)-xp(n))*s...

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
How to obtain maximum values in the y-axis and corresponding x-values in a given dataset?
Let a - your array (1032x2) B = sortrows(a,-2); out = B(1:10,:);

mehr als 8 Jahre vor | 0

| akzeptiert

Mehr laden