Respondida
how to make the same length in the struct
s=struct('a',rand(5,1),'b',rand(3,1),'c',rand(6,1)) maxheight = max(structfun(@height,s)); padarrays = structfun(@(x) [x; ze...

más de 2 años hace | 2

Respondida
Matrix and vector multiplication of size using a CPU is very slow. Using GPU is much quicker but I need a way around the size limitation.
"I thought, because I skim read (it's an age thing!) that gather transferred stuff from GPU to ordinary memory. I'm not convince...

más de 2 años hace | 0

Respondida
Counting zeros which are lying between nonzero elements by considering consecutive zeros as a single element in a matrix
A=[1 0 1 1 1 0 0 1;0 1 0 1 1 0 1 0;0 0 1 0 0 0 0 0;1 0 1 1 0 0 1 1] max(sum(diff(~~A,1,2)==1,2)-~A(:,1),0) % If A is binary ...

más de 2 años hace | 0

Respondida
generate array of Different random floating numbers in a specific range
" (1, 100) in MATLAB. randperm is creating integer, but I want float numbers , preferable with 1 decimal point. Like 20.1 , 34.2...

más de 2 años hace | 0

Respondida
Counting zeros which are lying between nonzero elements by considering consecutive zeros as a single element in a matrix
Always helpful the old for-loop A=[1 0 1 1 1 0 0 1;0 1 0 1 1 0 1 0;0 0 1 0 0 0 0 0;1 0 1 1 0 0 1 1] [m,n] = size(A); count ...

más de 2 años hace | 0

Respondida
Finding the first 1 in a binary set using optimization
You ask the same question several time. Without any other a priori knowledge, scan your array until 1 is meet. There is no mira...

más de 2 años hace | 0

Respondida
Counting zeros which are lying between nonzero elements by considering consecutive zeros as a single element in a matrix
A=[1 0 1 1 1 0 0 1;0 1 0 1 1 0 1 0;0 0 1 0 0 0 0 0;1 0 1 1 0 0 1 1] d=diff(A~=0,1,2); [~,i,v]=find(d'); vl=zeros(size(A,1),1)...

más de 2 años hace | 0

Pregunta


Slider (legacy) with no room to slide?
I would like to create a slider (legacy version) to select a whole number from 1 to a given n. For n >= 2 this is OK, the curso...

más de 2 años hace | 1 respuesta | 0

1

respuesta

Pregunta


What functions need GPU support
Recently there are few posts about function that are not fully support gpuArray and could benefit from more intensive GPU suppor...

más de 2 años hace | 3 respuestas | 1

3

respuestas

Respondida
Optimizing for speed. Moving skewness finder. Cumulative sum proving to be bottleneck.
Speed optimized code changes are: Vectorize for-loop Avoid padding 0 by treating the first "iteration" in separate code. Mutu...

más de 2 años hace | 0

| aceptada

Respondida
Why does Matlab 2023a crash when running my code?
/home/matt/MATLAB-Drive/Lab/required_files/oms/supporting_files/code_thirdparty/TobiiPro.SDK.Matlab_1.6.2.36/lib/64/tobiiresearc...

más de 2 años hace | 0

| aceptada

Respondida
Change zoom mouse cursor and mouse wheel zoom factor in R2019
My workwround solution % test zoom mouse scroll wheel accelerator close all plot(sin(linspace(1,10))) figh = gcf; % Do th...

más de 2 años hace | 0

Respondida
Matrix and vector multiplication of size using a CPU is very slow. Using GPU is much quicker but I need a way around the size limitation.
I run your (slighly modified) code with xRange = 100 (EDIT) and get the finite result My config: R2023a, Windows 11, Laptop 32 ...

más de 2 años hace | 0

| aceptada

Respondida
Faster three dimensional higher order interpolation?
You probably need to change an existing open interpolation code to use efficiently gpu arrays. The cubic methode is smooth meth...

más de 2 años hace | 0

Respondida
Optimization of a script
The v you compute is simply 132*b*(c-1) You want to optimiza it? Take b=Inf and c=Inf

casi 3 años hace | 1

| aceptada

Respondida
Efficient searching to find the first element of an array meeting a condition
just fo the obvious for loop for i = 1:length(x) if expensive_check_for_meet_condition(x(i)) ifind = i; ...

casi 3 años hace | 2

Respondida
Automatically set number of outputs of the gradient function
A = rand(10,10,10); % This works for any dimensions of A if isvector(A) % EDIT N = 1; else N = ndims(A); % 3 in t...

casi 3 años hace | 1

| aceptada

Pregunta


How to check if an object is NaN
I want to check a generic object "is equal" to NaN. The command isnan(object) throws an error and the command isequal(object, N...

casi 3 años hace | 1 respuesta | 0

1

respuesta

Respondida
Why result of conv and point wise multiplication has different result?
You have at least 2 errors in your codes The convolution by for-loop needs to flip the kernel (Morlet) The MATLAB convolution ...

casi 3 años hace | 0

| aceptada

Respondida
Runge-Kutta with a function that changes at each time step
Again everything is written in the doc of ode45 "For information on how to provide additional parameters to the function odefun,...

casi 3 años hace | 0

Respondida
Using Runge-Kutta in Matlab
" I can calculate an arbitrary velocity f(x,t) from the forces acting on a position x." Good this is a very good starting point...

casi 3 años hace | 0

| aceptada

Respondida
Extract rows from a matrix considering continuous numbers in the first column
For multiple values of rmax (in a vector) matrix = ... [59 1 2 3 1899 % I invent it 60 210 96 92 398 62 33...

casi 3 años hace | 0

| aceptada

Respondida
How can I implement these for loops efficiently using covolution?
Use conv x = (0:0.2:5).^2; L = 3; delta = rand; T = rand; % Your method xSinc = zeros(size(x)); for xx = 1:length(x) ...

casi 3 años hace | 1

Respondida
Plot multiple data sets fast - fastest/latest/efficient method up to R2023a
@Florian Berzsenyi Is is possible and viable to preallocate all lines first, and then call drawnow expose? Yes. Note the I pe...

casi 3 años hace | 0

Respondida
elements >0 are present in matrix only once
a= [3 5 9 12 0 0 0 0 4 6 7 8 10 11 0 0 15 17 18 19 ...

casi 3 años hace | 0

| aceptada

Respondida
ismembertol second output specification
Here is my though on what index ismembertol returns. It is the first index that A belong after rearrange B by dictionary like s...

casi 3 años hace | 0

Respondida
Memory required for struct array
The function structbase_bytesize_fun that computes the "base" memory of the struct s is as following: fieldname_bytesize = name...

casi 3 años hace | 0

Pregunta


Memory required for struct array
In this answer https://www.mathworks.com/matlabcentral/answers/2010767-struct-function-in-matlab Walter Roberson gives some num...

casi 3 años hace | 1 respuesta | 0

1

respuesta

Respondida
The least square with changing number of lines of matrix
A = rand(24,6); % your full matrix b = rand(24,1); % your measurements % which data you want to remove? removeidx = [1 4 24...

casi 3 años hace | 0

Respondida
ismembertol second output specification
@Steven Lord "use the form at the bottom of the documentation page" Do you mean clicking on the rating with "stars"? If yes I j...

casi 3 años hace | 1

Cargar más