Respondida
How do i extract only prime numbers from a matrix
V = randi(1000,1,100) % fake data P = V(isprime(V)) % the prime values

19 días hace | 0

Respondida
A very fast way to sort datetime (in "ascend" mode)?
"Any way faster than this one" Interestingly, sorting seems to be slightly faster with the superfluous call to DATENUM: a = da...

19 días hace | 1

Respondida
Converting date number datetime
inp = [315552; 315555; 315558; 315561; 315564; 324333] dt = datetime(1800,1,1) + hours(inp)

19 días hace | 0

Respondida
how to separate columns from txt file

19 días hace | 0

Respondida
Strange result from comparison
"Why does this happen?" Because of the accumulated floating point error. Lets have a look at the values involved, to a higher p...

20 días hace | 0

Respondida
Converting cell to array data with specific string
The simplest approach: M = readmatrix('test.txt', 'TrimNonNumeric',true)

20 días hace | 3

Respondida
Error using vertcat, dimensions of arrays being concatenated are not consistent
Use a string array rather that trying to vertically concatenate incompatible character vectors: Name = ["Beam On (UTC)"; "Beam ...

20 días hace | 0

Respondida
Limit value to a function
y = min(1750,y)

20 días hace | 1

Respondida
Extract values from multiple txt file
First lets create some fake data files just for testing this code: writematrix(1:2,'file1.txt') writematrix(3:4,'file2.txt') ...

20 días hace | 1

Respondida
merge the cells from a structured array

20 días hace | 0

Respondida
Separating daytime and nighttime according to daily sunset and sunrise values
M1 = load('Data1.mat') D = M1.Data1; DT = datetime(D(:,1),'ConvertFrom','datenum') M2 = load('sunrise and sunset.mat') SR = ...

21 días hace | 0

Respondida
date time from filename
First lets create some fake data files just for testing the code: writematrix(1:3,'P02_PRO_ST_20221115_151337.csv') writematri...

21 días hace | 0

Respondida
Split a char without spaces and arbitrarily characters
format long G txt = ' 17575 3.10705E+00-7.07230E+01-1.77433E-01-2.72479E-05-7.19082E-06-9.65426E-06 1.70247E-04 4.89104E-05...

21 días hace | 0

Respondida
How to call function repeatedly using arrays as variables?
You need to provide a function handle, not call the function (as you are doing): B = arrayfun(@myComparator, Va, Vb); % ...

22 días hace | 1

Respondida
Table column of strings to a matrix.
A = ["[0 0 0 0 0 0 0 0]";"[0 0 0 0 0 0 0 0]";"[0 0 0 0 0 0 0 0]";"[1 1 1 1 1 1 1 1]"] M = cell2mat(cellfun(@str2num,A,'uni',0))...

23 días hace | 0

Respondida
Abbreviate regexp: match a if present, else match b
It is possible to combine them, but it will be fiddly and not very efficient because it requires in some way checking the entire...

23 días hace | 0

Respondida
Problem with double use of a for loop?
A-B

24 días hace | 0

Respondida
Group number identification consecutive numbers
X = [1;0;1;1;1;0;0;0;1;1;1;0;1;1;0;0;1;1;0;1;0;0;1;1;0;1;1;1;1;0;1;1;1;1;1;;0;1;1;1;1;1;1;1;1;1;0;0;0;1;1;1;1;1;1;1;1;1;1;1;1;1;...

26 días hace | 3

Respondida
multiply vector of (2x1) to each of the (2x2) matrix in a (2x2x145) double data
"I want to multiply a vector of (2x1) to each of the (2x2) matrix in a (2x2x145) double data,F." Use PAGEMTIMES https://www.mat...

27 días hace | 0

Respondida
Remove the loop from a sum of index expression
Hiding the loop even more (really everything uses loops, even vectorized code): % Example setup n = 5; m = 10; M = randn( m,...

27 días hace | 1

Respondida
How can i extract the numbers from string?
Here are two approaches: C = {'104p8.png','105.png','105p2.png','105p4.png','105p6.png','105p8.png','106.png','106p2.png','106p...

30 días hace | 0

Respondida
Read different folders by changing path with for loop
P = 'C:\Users\Alberto\Download\...\...\...'; D = dir(fullfile(P,'DATA*')); for k = 1:numel(D) F = fullfile(D(k).folder,D(...

30 días hace | 0

Respondida
How to decide, number or character!
A = ';A0sf1001p00'; X = isstrprop(A,'digit'); N = A(X)

30 días hace | 1

Respondida
How to save an indefinite number of outputs to a struct
"Is there anyway to do this?" Of course. But forcing pseudo-indices into structure fieldnames is much less efficient and more c...

30 días hace | 1

Respondida
Rename File in a Different Folder
new = fullfile(prjNo + 'REPORT'+ date +'.txt'); % odd use of FULLFILE. movefile(fullfile('.','OUT','REPORT.txt'),fullfile('.','...

alrededor de 1 mes hace | 0

Respondida
Problem reading double array from excel
READCELL et al import text as text, not as double. You could use STR2NUM on the text: C = readcell(..) N = str2num(C{1})

alrededor de 1 mes hace | 0

Respondida
Update array elements with the element before
V = 1:6 Z = cumsum(V)

alrededor de 1 mes hace | 0

Respondida
modify anonymous function using eval
I assume that you want to select from a larger set of different parameters. In that case, put them all into one cell array and t...

alrededor de 1 mes hace | 0

Respondida
Sorting cell arrays with characters and numbers
"What method can be used to get the right order?" You could download my FEX submission NATSORT: https://www.mathworks.com/matl...

alrededor de 1 mes hace | 1