Answered
Can I write this in a more compact way?
Cellfun/arrayfun is just disguished for-loop. They are more compact in syntax, less flexible and often slower. Then the proper ...

7 years ago | 0

| accepted

Answered
Finding a vector as a subset of an array
[u,~,j] = unique(a(:)); [tf,loc] = ismember(b(:),u); s = [length(u),1]; result = all(accumarray(j(:),1,s) <= accumarray(loc(t...

7 years ago | 0

| accepted

Answered
How can I convert an array of hex values to a num?
>> xa=dec2hex('0.01') xa = 4×2 char array '30' '2E' '30' '31' >> a=str2double(char(hex2dec(xa))...

7 years ago | 1

| accepted

Answered
Creating all possible binary sequences for specific length under certain constraints
This code works for toy dimension(s), if you take n up to 96 you might have memory issue as people have rightly warned you. n ...

7 years ago | 0

| accepted

Answered
How to use CROSS with 3x1 Matrix on a 3xN Matrix
For my own use I have written this function %% function c = cross_dim1(a,b) % Calculate cross product along the first dimensi...

7 years ago | 0

Answered
Diagnose infeasibility of linear programming
"I need to check which constraints can be relaxed to well-define the problem." It likes asking: when a glass of water spills o...

7 years ago | 0

Answered
How to call vector in matrix with condition
[tf,loc] = ismember(A(:,1),B); r = sortrows([loc(tf),A(tf,4)],1); r(:,2) ans = 20 30 50

7 years ago | 0

| accepted

Answered
I need to perform a 3D fourier transform on a large 3D array (10^9 data points), is there anyway I can reduce the memory demands of this process.
You might use SINGLE intead of DOUBLE psi = single(psi); fftpsi = fft(psi,[],3); Next might be working slide by slide, not su...

7 years ago | 1

| accepted

Answered
How can I find all nodes that should precede node 'Node' from the information contained in a digraph G?
source = [1 1 2 3 4 5 7]; sink = [2 3 5 4 7 4 6]; node = 4 p = FindprecNodes(source, sink, node) function p = FindprecNode...

7 years ago | 1

Answered
Speeding up Sort Algorithm by removing ismember
time = [ 1 3 2 4 7]; signal= [12 14 11 13 16]; [time, signal] = mysortdata(time, signal) %% function [time, signal] =...

7 years ago | 1

| accepted

Answered
point cloud with matlab
OP's question "I really want to ask regarding 3D Point cloud. we have points with X, Y, Z. We are totally new at this work. Wit...

7 years ago | 1

| accepted

Answered
Is there any solution to generate an orthogonal matrix for several matrices?
What you ask is the eigen-vectors common for all three matrices. In general no, such system does not exists. I can even show th...

7 years ago | 0

Answered
Solving a system of linear equations with a few known variables
Assuming known is the logical index == TRUE for indexes of x that are known % known = ismember(1:5,[1 5]) % in your example ...

7 years ago | 0

| accepted

Answered
point cloud rot in matlab
xyz=xlsread('PointClouds.xlsx',3); % Find the rotation axis xyzc = mean(xyz,1); xyzr = xyz-xyzc; [~,S,V] = svd(xyzr,0); ...

7 years ago | 1

Answered
How to fit linear plateau equation ?
You can use this FEX file (BSFK) The code is by default use QUADPROG from MATLAB, but can also work with QPAS project by Adri...

7 years ago | 0

| accepted

Answered
Best/fastest way to call MATLAB routine from C repeatedly
You must not do Loading, Init, Close repeatly. They must be called once, then you must call whatever function you want repeatly...

7 years ago | 1

Answered
Finding the pseudo inverse of a matrix
For non-full rank square matrix A, there exists no matrix B such that A*B = I So the pinv(A) (at the B place) won't make mirac...

7 years ago | 0

Answered
Why linprog give answer not satify the constrains?
Because you never pass constraints A*x <= b in LINPROG [x, f] = linprog(f,[],[],Aeq,beq,lb,ub,options);

7 years ago | 0

| accepted

Answered
Finding particular solution to 3x3 matrix using undetermined coefficients
Guys, this is a linear system, why using FSOLVE? >> [-15/4 0 0; 15/4 -5/12 0; 0 5/12 -5/14]\[-1575; 0; 0] ans = ...

7 years ago | 1

Answered
How to use all the other indices except of the ones given in an array?
A(idx) = 0; B(setdiff(1:end,idx)) = 0;

7 years ago | 3

| accepted

Answered
Selecting more than one range of elements of a vector with a single line code
a([1:10, 90:100])

7 years ago | 1

| accepted

Answered
Alternatives to using diff(X,2)
Just apply the same method twice D1 = A(2:end)-A(1:end-1); D2 = D1(2:end)-D1(1:end-1) or D2 = conv(A,[1 -2 1],'valid')

7 years ago | 2

| accepted

Answered
Why aren't sparse matrices padded with zeros to the highest sizes?
Not specific to sparse, similar such operator on full matrices also returns error. A sparse matrix is designed to be equivalent...

7 years ago | 0

Answered
I found a mistake in Lasso function
There is no bug, just misunderstanding of OP. N is the number of observations, meaning the number of rows of X and length of y...

7 years ago | 1

| accepted

Answered
Covert matrix to sub-matrices
A = reshape(yourdata, [2035,1476,3]); A = permute(A,[1 3 2]); Now invoking: A(:,:,k) returns kth matrix of size (2035 x 3),...

7 years ago | 0

Answered
vectorise a row number search
AA = B(A)

7 years ago | 1

| accepted

Answered
Find matches without repetition from two cell arrays + extra condition
You don't even need the period table, assuming element start with an Uppercase eventually followed by lower-case NameSpecies = ...

7 years ago | 1

| accepted

Answered
how to find the shortest distance between two lines in R3 ?
No need a big hammer, a simple formula is enough d = abs(null([x1(:)-x0(:),y1(:)-y0(:)]')'*(x1(:)-y1(:))) Or to avoid NULL n ...

7 years ago | 0

| accepted

Load more