Respondida
how to modify the variables for changing FOR loop to PARFOR loop??
What is the bottleneck of your code? Use the profiler to find it. If it is the water() command, parallelize this command: lArra...

casi 4 años hace | 0

Respondida
How to downsample the 3D matrix in matlab??
X = rand(1500, 1500, 1700); % 28.5 GB - does not run in the forum! Y = reshape(X, 2, 750, 2, 750, 2, 850); Z = squeeze(sum(Y...

casi 4 años hace | 1

| aceptada

Respondida
I AM WRITTINF THIS CODE AND GETTING THE FOLLOWING WARNING
Check this again: which image -all Is there a user-defined function in the list? If not, clear all should solve the problem a...

casi 4 años hace | 0

| aceptada

Respondida
Changing elements of row after certain element of m*n matrix
x = [-1, -0.65, -0.45, 0, 0.3, 0.8, 1, 0.4, 0.2, -0.1; -1, -0.65, -0.45, 0, 0.3, 0.8, 0.9, 1, 0.2, -0.1]; idx = ...

casi 4 años hace | 1

| aceptada

Respondida
Find the value of r such that the determinant of A is zero.
Remember, that Matlab uses IEEE754 doubles with limited precision. Then -5.5511e-17 is almost 0. The result is correct. See: ht...

casi 4 años hace | 0

| aceptada

Respondida
startup script for whole team
I use a tool to syncronize a function, which is updated by others in this forum: https://www.mathworks.com/matlabcentral/answers...

casi 4 años hace | 0

Respondida
create function in loop
Simplify F_sum4 = 0; start=1; stop=810; for n = start:stop F_sum4 = F_sum4 + F(:,:,n) CY_sum4 = mean(cy_sum(start:...

casi 4 años hace | 0

| aceptada

Respondida
I can't open and uninstall due to the error, how to resolve it?
The message suggest to re-install Matlab. So do this: install it over the existing version.

alrededor de 4 años hace | 0

Respondida
Read the original output variable of function
This is impossible. If the code is not visible for the user, the names of the variables are not visible also. But remember, that...

alrededor de 4 años hace | 0

Respondida
How can I use the ( nchoosek ) for this case nchoosek(x,y) where x=[1:1:80] , and y=64;
80 over 64 is 26'958'221'130'508'525. Then nchoosek(1:80, 64) needs 26958221130508525 * 64 * 8 Bytes in the RAM, which is 1,38 P...

alrededor de 4 años hace | 1

Respondida
Decimal and very small values returning zeros
No, Matlab uses the standard IEEE754 conventions and has no rounding errors. The question is funny: A huge number of scientists...

alrededor de 4 años hace | 0

Respondida
vectorize nested loops interpolation
% Your code: a_min = 1e-10; a_max = 1; na = 200; a_grid = linspace(a_min,a_max,na)'; Nsim = 10000; % Desired value is la...

alrededor de 4 años hace | 1

| aceptada

Respondida
Plot one data set with two different units?
This is a lot of information and code, which has no relation to the actual problem. What exactly is the detail you want to chang...

alrededor de 4 años hace | 0

Respondida
Is it possible to set a vector as an users input'
Such inputs are obtained using a GUI usually. The callbacks of the edit fields control the type of the input. A loop would be e...

alrededor de 4 años hace | 1

| aceptada

Respondida
Why are xlsread (and readtable) doing such a poor job at loading mixed data files?
The automatic detection of string types is known to be a source of severe bugs. The genes "Dec1", "SEPT1" and "MARCH1" have been...

alrededor de 4 años hace | 1

| aceptada

Respondida
How to skip NaN arrays outputs of a for loop?
doBreak = false; for Nj2 = 1:cj2 for Mj2 = 1:rj2 J2= j2(Mj2,Nj2); e3=(exp(C1_p).*hermiteH(M-M2...

alrededor de 4 años hace | 0

| aceptada

Respondida
Is it possible to denormalize data created via the 'units', 'normalized' handles? /where does the handle get it's inputs from?
About the reverse of the normalize() function: This is impossible. See: X = 1:5; normalize(X) normalize(X + 1) After the nor...

alrededor de 4 años hace | 0

Respondida
My mex file is slower than my original matlab equivalent
Just some experiments. You can gain some clarity, but hardly improve the speed with this simplifications. I've tried a loop vers...

alrededor de 4 años hace | 0

| aceptada

Respondida
not enough input arguments, odes
See: Answers: Anonymous function to provide parameters k1 = rand; k2 = 18; etc = 21.7; ... and so on [t,x] = ode45(@(t,x) o...

alrededor de 4 años hace | 0

Respondida
Using cellfun to pull information
cellfun works on cell arrays, as the name says. You are working with tables. So this command does not match at all. Color1 = ["...

alrededor de 4 años hace | 0

| aceptada

Respondida
Converting a vector of structs to just one struct (vectorizing)
X = cat(1, S(:).FieldName); % Or shorter: X = cat(1, S.FieldName); % Example: S(1).FieldName = [1,2,3]; S(2).FieldName = ...

alrededor de 4 años hace | 0

| aceptada

Respondida
how to Enter same string in whole column?
T = table('Size', [5, 2], 'VariableTypes', {'string', 'double'}); T{:, 1} = "str"

alrededor de 4 años hace | 0

Respondida
Not pausing on error in unit test
If the errors are caught by TRY/CATCH blocks, you can stop Matlab and enter the debug mode by: dbstop if caught error Type thi...

alrededor de 4 años hace | 0

Respondida
Vectorization of nested loop
It is hard to improve the speed of code without having data to run the code. But start with calling interp1 once only. Q = i...

alrededor de 4 años hace | 0

Respondida
How to make two for loop plots appear next to each other at the same time?
Move the code of both loops into one loop. Define the parent of the dranw objects. Example: FigH = figure; Axes1 = subplot(1,...

alrededor de 4 años hace | 0

| aceptada

Respondida
cannot assign values to a cell during a parfor loop
Try this: fold_list = cellstr(strcat('Folder_',num2str((100:125).','%#4.d'))); % By the way: Simpler: % fold_list = sprintf...

alrededor de 4 años hace | 1

| aceptada

Respondida
Changing elements of row after certain element
x = [-1,-0.65,-0.45,0,0.3,0.8,1,0.4,0.2,-0.1]; idx = find(x == 1, 1); if ~isempty(idx) x(idx + 1:end) = 0; end

alrededor de 4 años hace | 1

Respondida
Importing data without using read functions
T = fileread(Text); C = strsplit(T, newline); Head = strsplit(C{1}, ','); Body = reshape(split(C(2:end), ','), numel(C) - 1...

alrededor de 4 años hace | 0

Respondida
Conversion to cell from double is not possible.
If a variable is not defined before, the default type is double . You want to access a as a cell, so define it accordingly: a =...

alrededor de 4 años hace | 0

| aceptada

Respondida
How to continue loops with few if statement between them
This is nicer without a loop: mean_travel1 = sum(arrival(depart_time < 100,1)); mean_travel2 = sum(arrival(100 < depart_time &...

alrededor de 4 años hace | 0

Cargar más