Beantwortet
how can I generate different vectors with the all the unique combinations of numbers inside a one vector?
a=[1 2 3 4] r = cell; for ii = numel(a)-1:-1:1 r = [r;num2cell(nchoosek(a,ii),2)]; end

mehr als 10 Jahre vor | 0

| akzeptiert

Beantwortet
How to extrapolate gridded matrix?
use |scatteredInterpolant| Hs = [4.9573 6.6098 8.2622 9.9147 13.2196 16.5245 24.7868 33.0490]; Uw = [1.12 2.4500 4.4...

mehr als 10 Jahre vor | 1

| akzeptiert

Beantwortet
QUESTION ON MATRIX RESHAPING
a = reshape(1:9,3,[])'; out = kron(a,ones(3)); or out = repelem(A,3,3)

mehr als 10 Jahre vor | 0

| akzeptiert

Beantwortet
What changes should I make to save the values of P? P should at least be a 2×2 matrix!!
n = (1:2:19)'; t = n*pi/b; P = [n, cumsum(c*sin(t*x).*sinh(t*y)./sinh(t*a)./n)];

mehr als 10 Jahre vor | 0

Beantwortet
Find the First element that satisfies a condition
t = A < 5; x = cumsum(t,2) == 1 & t; out = sum(x.*A,2); out(~any(t,2)) = nan idx = x*(1:size(A,2))'

mehr als 10 Jahre vor | 3

Beantwortet
How can i optimize my code without a for-loop ?
R = bsxfun(@minus, r_source, r_rec); sqr1 = 1./sqrt(sum(R.^2,2)); r1 = bsxfun(@times,R,sqr1); r2 = 3*r1(:,3)*m0; ...

mehr als 10 Jahre vor | 0

Gelöst


Fill the Matrix - 2
Input is a column vector and n. n columns will be added to the left of the input column. The first value of the row is the me...

mehr als 10 Jahre vor

Gelöst


Fill the matrix - 1
Input is a column vector and n. n columns will be added to the left of the input column. The first value of the row is the s...

mehr als 10 Jahre vor

Beantwortet
Minimum of unique values
[~,~,c] = unique(x); z = accumarray(c(:),y(:),[],@min);

mehr als 10 Jahre vor | 0

Gelöst


Is my wife really right?
For every input, output the string 'yes' once. Example: [yes1, yes2] = YesSheIs('Am I right?', 'Do you love me?') yes1 = '...

mehr als 10 Jahre vor

Gelöst


Find the next square number
Given one or more integers n, find the next integer that is a square, for each of them. Example 1: n = 1; out = 4; ...

mehr als 10 Jahre vor

Beantwortet
On vectorizing a function that takes vectors and scalars as inputs
XY -> array (X,Y) coordinates with size [m X 2]; XY0 -> array (X0,Y0) with size [n X 2] out = squeeze(bsxfun(@hypot,XY...

mehr als 10 Jahre vor | 0

| akzeptiert

Beantwortet
Downsampling by Averaging in Blocks
y=[1,2,3,4,5,6,7,8,9,10,11]; out = nanmean(reshape([y(:); nan(mod(-numel(y),4),1)],4,[]));

mehr als 10 Jahre vor | 7

| akzeptiert

Beantwortet
Counting program every positive element
Let date1 - arrey with your dates, DATA - your data f = fopen('kwazi_data_1993.txt'); c = textscan(f,'%s','delimiter','\...

mehr als 10 Jahre vor | 0

Beantwortet
Impor text file: starting from the first row of numbers
f = fopen('filebyYoulin.txt'); c = textscan(f,'%s','delimiter','\n'); fclose(f); str = regexp(c{:},'\d*\.\d*','ma...

mehr als 10 Jahre vor | 0

Beantwortet
How do I avoid using for loop when I want to treat the rows of a matrix individually?
B=[1 2 1 3;1 2 1 4;1 3 1 4;1 2 1 6;1 4 1 5;1 5 1 3;1 5 1 7]; A=[1 2;1 5]; D=[1 3;1 4;1 5;1 6]; [lo,ii] = isme...

mehr als 10 Jahre vor | 0

Beantwortet
Help with for loop indexing
st = ' he who sees and he who is not '; a = regexp(st,'\w*','match'); outStr = strjoin(a(cellfun(@numel,a)>2),' ');

mehr als 10 Jahre vor | 0

Beantwortet
Solving a matrix (bidiagonal) in MATLAB
X = A\B

mehr als 10 Jahre vor | 1

Beantwortet
how can i save row value in variable like x(1)
>> row =[1 1 0 0; 1 1 0 0; 0 1 1 0 ; 1 1 0 0] ; x = row; x(1,:) ans = 1 1 0 0 >> x(2,:...

mehr als 10 Jahre vor | 0

| akzeptiert

Beantwortet
Make a function that will receive two parameters: 1. the number of multiplication tables, and 2. the number of multiplications in each table.
function multiplication_tables(x,y) [yy,xx] = ndgrid(1:y,1:x); xy = (1:y)'*(1:x); ii = [xx(:),yy(:),xy(:)...

mehr als 10 Jahre vor | 0

| akzeptiert

Beantwortet
How to read data from a .txt a put it in different vectors?
*EDIT* f = fopen('d20160301_2.txt'); c = textscan(f,repmat('%f',1,6),'EmptyValue',0, 'CollectOutput',1); fclose(f);

mehr als 10 Jahre vor | 0

Beantwortet
Split a vector into multiple vectors based on a value in the original vector
V = [0 2 0 0 5 7 0 14 0 0 0 17 19 20]; V0 = V(:)'; i0 = diff(strfind([0,V0,0],0)); out = mat2cell(V0(V0 ~= 0),1,i...

mehr als 10 Jahre vor | 0

Beantwortet
Making a matrix of NaN and integers
padarray (I, [1,1],nan); % I - your array

mehr als 10 Jahre vor | 0

Beantwortet
I need to create an array (256 x 256) in which elements increments using loops.
I = zeros(256,256); k = 0; for i1 = 1:256 for i2 = 1:256 I(i1,i2) = k; k = k + 1; en...

mehr als 10 Jahre vor | 0

| akzeptiert

Beantwortet
How to read a txt that have this form?
f = fopen('d20160301.txt'); c = textscan(f,'%s','delimiter','\n'); fclose(f); k = regexp(c{:},'[A-Z]','match'); ...

mehr als 10 Jahre vor | 0

| akzeptiert

Beantwortet
Repetition of values in a vector.
out = sum(conv2(B,ones(4,1),'same') == 8); or a = conv2(B,ones(4,1),'valid') == 8; repeats = sum(a == 8); indexe...

mehr als 10 Jahre vor | 0

| akzeptiert

Beantwortet
How can I extract elements of a multi-dimensional array using the rows of another array as the indices? (more detail in the question)
A = [1,2,3;4,5,6;7,8,9] B = [1,3;2,1;3,2] C = A(sub2ind(size(A),B(:,1),B(:,2))

mehr als 10 Jahre vor | 1

| akzeptiert

Beantwortet
How could I convert a 3D matrix into several 2D matrix?
let A - your 3D matrice; [m,n,k] = size(A); out = mat2cell(A,m,n,ones(k,1)); out = out(:);

mehr als 10 Jahre vor | 0

Beantwortet
How to transform a matrix in Matlab?
[m,n] = size(A); [ii,k] = ndgrid(1:n-1,1:m-1); jj = A(2:end,2:end)'; b0 = accumarray([ii(:),jj(:),k(:)],1,[n-1,n-1,m-...

mehr als 10 Jahre vor | 0

Beantwortet
anyone help me please to crop the image into 8 bloks, 4 rows and 2 columns
[m,n,k] = size(x); out = mat2cell(x,m/4*ones(4,1),n/2*[1,1],k);

mehr als 10 Jahre vor | 0

Mehr laden