Community Profile # Bruno Luong

Last seen: Today Active since 2009

#### Statistics

All
• • • • • • • • • • • • #### Content Feed

View by

A compact way to find max in one column with a condition on the second column
a = [35 -1 21 1 11 2]; max(a(a(:,2) ~= -1,1))

etwa 9 Stunden ago | 0

| accepted

If one coordinate of the point is given how to find another coordinate?
I would go for brute force for general finite ring p=36683; b=0:(p-1)/2; b2=mod(b.^2,p); x=mod((9361)^3 + 23698* 9361 + 9684...

etwa 9 Stunden ago | 0

How do I speed up my variable lookup algorithm?
Try this % Fake data slantvals = randi([0 10], 1, 224*320*320); var = rand([5,5,5]); slantinds = randi(length(var),[numel(sl...

etwa 11 Stunden ago | 0

how to find correlation of a row with all the other rows of a matrix ?
If you have the right toolbox, use https://fr.mathworks.com/help/stats/corr.html

etwa 12 Stunden ago | 0

How to use the SUM() function..?
You overshadow sum function make sure to run clear sum before runing your code

2 Tage ago | 0

| accepted

Efficient way to assign indices to variables in a matrix
Timings with my brand new laptop with Jan's code Elapsed time is 0.004218 seds. % ISMEMBER Elapsed time is 0.001169 seconds. %...

3 Tage ago | 1

An error in filtfilt
Don't tranpose your date if you want to filter along the long dimension sig= P01EC1(:,:);

6 Tage ago | 0

| accepted

How to simulate Poisson Distribution Process?
@Safia is you want integer with fixed sum, I propose this, and it is no longer Poisson law strictly speaking lambda=3; T=60; %...

8 Tage ago | 1

How can I call a value in side the a function which is already evaluated.
If you want to retrieve value of a variable from the parent workspace inside a function without passing it as argument onstead o...

10 Tage ago | 0

| accepted

Matlab R2022b installation is not working
Probably the best way is to contact support https://servicerequest.mathworks.com/mysr/cp_case_new1?cc=uk

13 Tage ago | 0

Free-knot spline approximation (BSFK) problem
Reference to BSFK function https://fr.mathworks.com/matlabcentral/answers/1810010-free-knot-spline-approximation-bsfk-problem H...

14 Tage ago | 0

| accepted

Bug in audioread with native option R2022b?
I has been confirmed by TMW support that is indeed a bug due to third party library they are using.

15 Tage ago | 0

| accepted

Normal random number generation
Here is an alternatve without stats tbx https://uk.mathworks.com/matlabcentral/fileexchange/23832-truncated-gaussian?s_tid=srch...

15 Tage ago | 0

Comparing large sparse matrices for differences close to machine precision
One way to compare matrices is to display norm(A-B, Inf) / norm(A, Inf) It should be at machine precision (~1e-15) of at worst...

16 Tage ago | 0

Question

Bug in audioread with native option R2022b?
The audioread command with 'native' option should return the native type of the waveform. It seems there is a bug in R2022b, wh...

16 Tage ago | 1 answer | 0

### 1

How does the mod function compensate for floating point round off?
Second version, correction under stricter condition than in the first version function r = rmod2(x, a) k = round(x/a); r = x ...

17 Tage ago | 0

How does the mod function compensate for floating point round off?
I try to replicate MATLAB mod ith this function, it seems working well for 2 examples, no warranty beside that. x=(rand(1,1e6)-...

17 Tage ago | 1

Vectorization: incompatible sizes of arrays
Simpler one liner O(:,2) = P(randi(end,n_o,end),2) + repelem(P(:,2),n_o) / 2;

18 Tage ago | 1

How to set the parent of the subplot in a neat way?
ax = subplot(1,2,2,'Parent',fig1)

19 Tage ago | 1

| accepted

Vectorization: incompatible sizes of arrays
O(:,2) = reshape(reshape(P(randi(end,n_o,end),2),n_o,[]) + reshape(P(:,2),1,[]), [],1) / 2;

19 Tage ago | 0

Can a Dictionary Key be a char?
The syntax that needs to be used is d = dictionary(char.empty(0,0,0), [])

19 Tage ago | 0

Simplest way to create a unit vector in Matlab?
if by "unit" vector you means vector where the elements are all 1s len = 9; V = ones(1,len)

19 Tage ago | 0

| accepted

Can a Dictionary Key be a char?
It looks to me that dictionary can accept both char array and string indisrtinctively as keys, as it convert to string internall...

20 Tage ago | 0

Generating a combination matrix within a certain condition
I hope it works. My output is transposed, meaning the number of columns of comb is number of sets. The maxsum is upper bound of...

21 Tage ago | 2

| accepted

How to get the same number of char as number of decimals using num2str?
input = pi str = num2str(input,16)

21 Tage ago | 0

| accepted

Is there faster ranking for matrices than double sort()?
Not sure it is faster, but on the theorical complexity it is better (single sort). A = randi(10,5,3) [~,I] = sort(A,1); [m,...

21 Tage ago | 1

| accepted

How to enable contour plot for 3D trisurf?
https://uk.mathworks.com/matlabcentral/fileexchange/38858-contour-plot-for-scattered-data

21 Tage ago | 0

Is there a Faster alternative to containers.Map function ?
In new release R2022b the dictionary is new implementation of hashing search/insertion. It looks great.

22 Tage ago | 0