Respondida
Create cell array of handle functions, which have been created from 2x1 double arrays
a = [1; 2]; b = [3; 4]; f = cell(2, 1); for ff = 1:2 f{ff} = str2func(sprintf('@(t) %d * t + %d', a(ff), b(ff))); end f

alrededor de 4 años hace | 0

| aceptada

Respondida
changing the legend line style (":","-","--","-.") for 4 black lines in plot instead of using multip colour
figure; axes('NextPlot', 'add', ... 'LineStyleOrder', cellstr([":", "-", "--", "-."]), ... 'ColorOrder', zeros(1, 3))...

alrededor de 4 años hace | 0

Respondida
Finding Sequences of 1's values
Some timings of the methods provided in this thread: x = randi([0, 1], 1, 80000); format long g disp(timeit(@() Jos(x))) d...

alrededor de 4 años hace | 0

Respondida
unix/system comand Always print out some environment setting when using it
% Without semicolon: system('pwd') % With semicolon: system('pwd'); % With semicolon and catching outputs: [status, out] = ...

alrededor de 4 años hace | 0

Respondida
Is there a reason why row vectors are default in Matlab?
Matlab was developped as "Matrix Laboratory". So the default type is a double matrix. If the focus has been set to vectors, it w...

alrededor de 4 años hace | 0

Respondida
Translate file name in mapped drive to unc path filename
No, there is no Matlab command to perform this automatically. net use sovles this and WMIC can help also: [status, out] = syst...

alrededor de 4 años hace | 0

Respondida
How to efficiently allocate memory using a parfor loop
ET = permute(E_mat, [2,3,1]); Q = zeros(size(ET)); parfor n = 1:size(E_mat, 3) Q(:,:,n) = sigmaE(n) / 2 / mass_density(n...

alrededor de 4 años hace | 1

| aceptada

Respondida
exportgraphics does not save at specific location
The folder is existing but Matlab cannot create a file in it. Then Matlab does not have write permissions in this folder. filea...

alrededor de 4 años hace | 0

Respondida
merge many mat files in one big vector
Why do you overwrite the first part of PSD_Monat in each iteration? for k=1 PSD_Monat([1:k*f1],1)=d(:,1) %d([1:k*f1],1)...

alrededor de 4 años hace | 0

Respondida
Is it possible to run Matlab Deep Learning Toolbox functions in Octave?
No. For 2 reasons: It is not 100% compatible (I'm sure!). The license conditions will not allow this. If you do have a license...

alrededor de 4 años hace | 1

| aceptada

Respondida
Min of each column of a sparse matrix?
For large inputs a loop is faster than accumarray: X = sprand(2000, 20000, 0.2); tic; for k = 1:10 [ii,jj] = find(X); ...

alrededor de 4 años hace | 0

Respondida
simplify my script?
Move all repeated work out of the loops. In your case: % Load data ncfile = 'Temperature.nc'; months = {'January'...

alrededor de 4 años hace | 0

| aceptada

Respondida
generate sine waves that appears after one another
figure; % Insert this: axes('NextPlot', 'add'); % Equivalent to: hold('on') ... Otherwise the plot() command clears it...

alrededor de 4 años hace | 0

Respondida
Function not processing dat for each element in array
Remember, that Matlab's IF condition must be a scalar. If you provide n as a vector, the line: if n >= 50 implicitly perfo...

alrededor de 4 años hace | 1

Respondida
Is there any equivalent keyword 'goto' in matlab not in simulink but in matlab coding
No, there is no GOTO in Matlab and it should be avoided strictly in good code. Maybe: function YourFunc n = 123; % ??? for ...

alrededor de 4 años hace | 0

| aceptada

Respondida
Storing output of function file in workspace
Nested nested functions - brrr. What about: t = 0.3:0.1:6; ? You store the variable Cfit in the workspace of the function Pa...

alrededor de 4 años hace | 0

Respondida
Readmatrix in struct using parfor
Fields names cannot contain the charcater '#' . fld = sprintf('File_%d', i); Data.(fld) = readmatrix(Files2Read{i}); ...

alrededor de 4 años hace | 0

| aceptada

Respondida
Need some help with re-formating a text.file using MATLAB?
Actually all you want to do is to replace the string a = sprintf('''10''\n') % by b = sprintf('''10'' good ') and c = sp...

alrededor de 4 años hace | 0

Respondida
how to make timer callback function?
app.something = 'hello'; tt = timer('Name','Test','Period',1, ... 'ExecutionMode','fixedSpacing','BusyMode','drop'); tt.Ti...

alrededor de 4 años hace | 0

| aceptada

Respondida
Load MatLab with Network License when Network is Unavailable
A network license is designed to work inside the specified network only. This is its nature. So you are asking for a break of th...

alrededor de 4 años hace | 0

Respondida
is it possible to use "for loop" for matrix?
X1 = zeros(1,6); X2 = zeros(1,6); for k=1:6 for j=1:n X1(1,k)=(j^k)+X1(1,k); X2(1,k)=(j^k)+X2(1,k); ...

alrededor de 4 años hace | 1

| aceptada

Respondida
How to make 3 arrays (Test , Test2, Test3) that are of different lengths into one matrix?
A matrix is a rectangular list of elments. This means, that all rows must have the same number of elements. Either fill the sho...

alrededor de 4 años hace | 1

| aceptada

Respondida
how to use multiple 'for loop' for one function?
Please post the complete error message, if you mention an error. This message contains the information, in which line the proble...

alrededor de 4 años hace | 0

| aceptada

Respondida
Iterating inside an iteration loop, while loop
This is not a bug, but useful for efficient code: 10^(-4) is an expensive power operation while 1e-4 is a cheap constant. if Z...

alrededor de 4 años hace | 0

Respondida
Compatibility of code when updating Matlab licence
See: https://www.mathworks.com/support/requirements/matlab-system-requirements.html R2021b supports Windows 7 SP1, while Win7 i...

alrededor de 4 años hace | 1

Respondida
Vectorize comparing a column vector in a matrix to all other vectors in the matrix.
Why do you want to vectorize this code? I assume, this will cause a slow down, because this creates large temporary array, which...

alrededor de 4 años hace | 0

| aceptada

Respondida
Share global variables between windows App Designer
Global variables are a mess in every case. Sending the data through a well defined interface would be much better. Do not use "...

alrededor de 4 años hace | 0

| aceptada

Respondida
Image resize without losing quality of image ? (urgent Issue)
Of course reducing the number of pixels reduces the resolution. But you can reduce the artifcats: imresize(Img, [640,427], 'lan...

alrededor de 4 años hace | 1

Respondida
how to delete all row contain a 1's and how to delete a column contain 1's. Q=[3 1 1 0 0 1;1 3 1 0 1 0;1 1 3 1 0 0;0 0 1 3 1 1;0 1 0 1 3 1;1 0 0 1 1 3]
Following your instructions: "Actually firstly i want to deleted the all columns that contain a 1's in first row. Then we check ...

alrededor de 4 años hace | 0

| aceptada

Respondida
Can I define my own special characters?
No, you cannot treat special characters in Matlab as functions. Of course, you can create a pre-processor, which replaces such ...

alrededor de 4 años hace | 1

| aceptada

Cargar más