Answered
MATLAB Initialization Takes Forever - After an out of Memory Overwhelming
Is one of the folders of Matlab's path a network drive or e.g. on Google Drive? Did you try to reset the preferences? Rename th...

6 years ago | 0

Answered
Help with splitting data
With older Matlab versions: match = strcnmp(data, 'D_', 2); result = strrep(data(match), 'D_', '');

6 years ago | 1

Answered
How do I store data that meet conditions of an if statement
xx = [-3; -3; -3; -3; -3; -3; 1; -2; -2; -3; -3; -2; 1; 1; 1; -2; 1; 1; ]; yy = [26.28; 36.96; 90.00; 90.00; 90.00; 90.00; 27.8...

6 years ago | 1

| accepted

Answered
Logical indexing of nonscalar structures
There is no abbreviation. There is no method for vectorizing the access of nested struct arrays. Maybe a tiny acceleration: g...

6 years ago | 0

Answered
Match numbers with letters
Name = 'David'; Num = lower(Name) - 'a' + 1; % 'a' -> 1, 'b' -> 2, ... Score = sum(Num); [EDITED] You mention in commen...

6 years ago | 1

Answered
What changed about matlab and tabs in a recent update?
I cannot confirm your observation: str = {sprintf('g1\t:\t14.203\t79.931\t50.598')} % str = 1×1 cell array % {'g1→:→14.20...

6 years ago | 0

| accepted

Answered
Efficient way to calculate distance matrix between cells
A 262144 x 262144 matrix of type double needs 550 GB of RAM. I assume that this will exhaust your machine. You need a different...

6 years ago | 0

Answered
Dividing a Matrix with a column vector
The p_i, you have provided, is not [10000 x 4] but [4 x 10000]. When I load the files and run: q_i = p_i.' ./ P; I get a [1000...

6 years ago | 0

| accepted

Answered
looping throwing errors, how can I avoid them?
[~,new] = fileparts(files(j).name); % Now "new" is a CHAR vector. new2 = strsplit(char(new(1)),'-'); % Splits the experim...

6 years ago | 0

| accepted

Answered
Porblem with indexing using a loop
You overwrite the array indices in each iteration: % Move here <------------------------------------\ for i=1:size(block,1) ...

6 years ago | 0

| accepted

Answered
Fastest match between 2 sequences
Another approach: function [i, s] = find_seq_v3(x, r) m = numel(x); n = numel(r); s = zeros(1, n + m - 1); for i = 1:m-1 ...

6 years ago | 0

| accepted

Answered
Fastest match between 2 sequences
As far as I understand, you want to accelerate this piece of code: function main r = char(randi(256,1,1e6)-1); x = char(randi...

6 years ago | 0

Answered
How to select the maximum value for each row in cell type variable in matlab?
Some rows of the cell Final contain only empty elements. What do you want to be the output in this case? If NaN is sufficient: ...

6 years ago | 0

| accepted

Answered
How to convert data byte by byte
A comparison of the runtimes: s = repmat('|0|01|00|5e', 1, 2000); tic for k = 1:100 d = hex2dec(regexp(s, '[0-9a-f]+',...

6 years ago | 0

Answered
How to convert data byte by byte
Do you really mean byte by byte? The variable read conatins 16 bit characters of the text as unicode, so a byte by byte conversi...

6 years ago | 1

| accepted

Answered
Display continuous stream of serial data in GUI text fields with callback function
Remember to insert a drawnow to let Matlab update the contents of the figure. This is most likely the solution of your problem. ...

6 years ago | 0

| accepted

Answered
Finding the row index of the closest match to a row vector in an array
search = randi([1, 10], 1, 3); data = randi([1, 10], 10, 4); dist = vecnorm(data(:, 1:numel(search)) - search, 2, 2); % A...

6 years ago | 0

| accepted

Answered
How can I increase the frequncy of a signal?
This sounds like a job for resample . interp1() can do this also.

6 years ago | 1

| accepted

Answered
How to switch differential equation when a certain value is achieved?
Note, that ODE45 is designed to work with differentiable functions only. So you cannot simply insert a flag for letting the firs...

6 years ago | 0

| accepted

Answered
how to create a matrix from a vector in this style
P = [0.9, 0.8]; n = 4; m = n*n + n; Q = zeros(n, n + 1); Q( 1:1+n:m) = P(1); Q(n+1:1+n:m) = P(2); or: Q = reshape(repmat...

6 years ago | 0

Answered
inputemu function works continuously
I guess, that you mean: https://www.mathworks.com/matlabcentral/fileexchange/28603-inputemu-keyboard-mouse-emulator-v1-0-1 Perh...

6 years ago | 0

Answered
How to pass additional variables with serial callback function (R2020b)
What about an anonymous function_ % [EDITED] Typo fixed: () around parameters of anonymous function, not {}! configureCallback...

6 years ago | 2

| accepted

Answered
handles.axis not working: cant set an image
Remember that the values of handles is fixed at the time, this callback has been defined. So if the fields "pleasewait" and "i1"...

6 years ago | 0

Answered
mat2str() on complex values with 0 inaginary part
Mathematically 5 is the same as 5+0i, so the output is correct. So omitting the imaginary part is a question of taste. If you ...

6 years ago | 0

| accepted

Answered
Opening word documents that are password protected in "read-only mode": how to close the pop-up window from Matlab
I cannot try it currently by my own: wdoc = word.Documents.Open([pwd '\' title], [], true); % [EDITED] true instead of 'true' ...

6 years ago | 1

| accepted

Answered
ODE OutputFcn returning fewer points than expected
The code looks okay. Check again if tspan has really 1001 time points. Use the debugger to check, what's going on. Set a breakp...

6 years ago | 0

Answered
Get only the digits in the first 2 characters of a string
filename1 = '13_data_rec_233'; filename2 = '1_data_rec_124'; num1 = sscanf(filename1, '%d', 1) num2 = sscanf(filename2, '%d...

6 years ago | 1

| accepted

Answered
Adjust measurement data with different vector lengths using interpolation
n1 = length(Vector_1); n2 = length(Vector_2); n3 = length(Vector_3); nMax = max([n1, n2, n3]); IP_Vector_1 = interp1(1:n1,...

6 years ago | 0

| accepted

Answered
Fix the function hlp
By the way, this can be done in one line: arr = reshape(1:n^2, n, n).' .^ ((1:n) .^ rem(0:n-1, 2)) Have fun with analyzing, ho...

6 years ago | 0

| accepted

Answered
Batch scheduler or pick up the run after wall time expires or checkpoints
DataFile = 'C:\Temp\YourData.mat'; if isfile(DataFile) Data = load(DataFile); else Data.i0 = 1; Data.j0 = 1; e...

6 years ago | 0

Load more