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

17일 전 | 0

| 수락됨

답변 있음
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...

17일 전 | 1

| 수락됨

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

17일 전 | 0

답변 있음
how to separate columns from txt file

18일 전 | 0

| 수락됨

답변 있음
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...

18일 전 | 0

| 수락됨

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

18일 전 | 3

| 수락됨

답변 있음
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 ...

19일 전 | 0

| 수락됨

답변 있음
Limit value to a function
y = min(1750,y)

19일 전 | 1

답변 있음
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') ...

19일 전 | 1

| 수락됨

답변 있음
merge the cells from a structured array

19일 전 | 0

답변 있음
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 = ...

19일 전 | 0

| 수락됨

답변 있음
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...

19일 전 | 0

답변 있음
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...

19일 전 | 0

| 수락됨

답변 있음
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); % ...

20일 전 | 1

답변 있음
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))...

21일 전 | 0

| 수락됨

답변 있음
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...

21일 전 | 0

| 수락됨

답변 있음
Problem with double use of a for loop?
A-B

22일 전 | 0

답변 있음
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;...

24일 전 | 3

답변 있음
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...

25일 전 | 0

| 수락됨

답변 있음
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,...

25일 전 | 1

| 수락됨

답변 있음
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...

28일 전 | 0

| 수락됨

답변 있음
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(...

28일 전 | 0

| 수락됨

답변 있음
How to decide, number or character!
A = ';A0sf1001p00'; X = isstrprop(A,'digit'); N = A(X)

28일 전 | 1

답변 있음
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...

28일 전 | 1

| 수락됨

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

약 1달 전 | 0

| 수락됨

답변 있음
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})

약 1달 전 | 0

| 수락됨

답변 있음
Update array elements with the element before
V = 1:6 Z = cumsum(V)

약 1달 전 | 0

답변 있음
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...

약 1달 전 | 0

답변 있음
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...

약 1달 전 | 1

| 수락됨

답변 있음
How to get the max value between two elements of two separate arrays?
The efficient MATLAB approach: a = [1,3,4,6]; b = [2,2,5,4]; c = max(a,b)

약 2달 전 | 1