回答済み
How can I sort a string both alphabetically and numerically?
By far the simplest approach is to download the NATSORT function: https://www.mathworks.com/matlabcentral/fileexchange/34464-cu...

3年弱 前 | 0

回答済み
How to access data of regexp output (without temporary variable)?
The general answer to the question has not changed much since 2012. Using a temporary variable is not "less efficient" as many ...

3年弱 前 | 1

| 採用済み

回答済み
How to sorting categorical array for plotting
By default the categories are sorted into character order, not alphanumeric order. S = "M"+(1:10); A = categorical(S) C = cat...

3年弱 前 | 0

| 採用済み

回答済み
Select last numeric character(s) of the string
"How can I extract the last numbers occurring at the end of different strings?" X = "sucrose-10"; Y = str2double(regexp(X,'[-...

3年弱 前 | 2

| 採用済み

回答済み
Compensate the vector with the last entry
V = [2,4,7,3]; K = 8; V(end+1:K) = V(end)

3年弱 前 | 0

| 採用済み

回答済み
why the code is incorrect? and where is incorrect? Matlab told me the function is incorrect, why?
"why the code is incorrect?" FZERO expects its first input argument to be a function handle: https://www.mathworks.com/help/ma...

3年弱 前 | 0

| 採用済み

回答済み
find equal value into cell
Forget about loops and FIND and ISMEMBER and other fiddling around, you should be using OUTERJOIN command. If your data are nice...

3年弱 前 | 1

回答済み
Using App Designer, reading a numeric edit field and creating a double array from the inputs?
The reason why it is a cell array is because you told MATLAB to make a cell array. Basically you are doing this: fc1 = 1; fc2 ...

3年弱 前 | 0

| 採用済み

回答済み
Getting all values in the same field for different entries within a structure
"Is it possible to get all the different math grades in an array without a for-loop?" Of course. The simple and efficient MATL...

3年弱 前 | 0

回答済み
How to change HH:mm:ss:SSS to HH:mm:ss.SSS for a column?
time = {'01:18:34:754'; '13:04:19:999'}; data = rand(2,1); T = table(time,data) tmp = regexprep(T.time,':(?=\d{3})','.'); T....

3年弱 前 | 0

回答済み
error when using '>' , Operator '>' is not supported for operands of type 'table'.
if significant{i,j} > 2 % ^ ^ https://www.mathworks.com/help/matlab/matlab_prog/access-data-in-a-table.html

3年弱 前 | 0

回答済み
Copy variables into excel smoothly
"So I wonder how I can work around this?" Don't copy-paste data into Excel. The simple, easy, robust approach is to use WRITEMA...

3年弱 前 | 1

| 採用済み

回答済み
Fill a matrix with another buy keep the original size
A = zeros(5,5); B = rand(3,5); A(1:size(B,1),:) = B https://www.mathworks.com/help/matlab/getting-started-with-matlab.html

3年弱 前 | 1

| 採用済み

回答済み
Adding to existing date value
"Using caldays does not update the month" Yes, it does: dt = datetime(2023,3,27, 'Format','u-MM-dd') dt = dt+caldays(5) Appa...

3年弱 前 | 0

回答済み
Why is NaN returned when I have all necessary input data?
"Does anyone see my mistake?" Your data has a range of approx 0.166: how many peaks do you expect to get with minimum peak prom...

3年弱 前 | 0

回答済み
How do I change the name of a variable (actually value of a character array) inside a loop?
"I do not see any oher solution then to edit the name while in the loop." What you are asking is just to change some text. This...

3年弱 前 | 0

| 採用済み

回答済み
regexp string to numeric array
Assuming that every string contains exactly the same number of numeric data: str = {'bob22alice666buster2', 'donald42lisa00budd...

3年弱 前 | 0

回答済み
finding a numeric pattern in a vector
Your basic concept is okay. You need to select an appropriate character match and quantifier. Note that the asterisk is actually...

3年弱 前 | 0

| 採用済み

回答済み
Merging Date and time
Rather than fiddling after importing, the best approach is to import the file correctly using READTABLE options, e.g.: fnm = 'L...

3年弱 前 | 2

| 採用済み

回答済み
Efficient way to convert m by n array into a single column table with each row containing n by 1 array?
A = [1 3 5; 2 6 7; 5 8 9; 3 2 1]; T = cell2table(num2cell(A.',1).')

3年弱 前 | 0

| 採用済み

回答済み
Rearrange cell array of strings based on occurrence in another cell array of string
Assuming that every text in B contains exactly one text from A, and that every text in A occurs in B: A = {'test1', 'test2', 't...

3年弱 前 | 0

| 採用済み

回答済み
I don't know how to use if function with or operator
The simple MATLAB approach: if any(data(i,1)==[0,0.0625,0.125,0.25,0.5,1,2,4,8,16,32]) or even simpler: if any(data(i,1)==[0,...

3年弱 前 | 2

回答済み
readmatrix error: "filename" must be a string scalar or character vector.
Get rid of DIR from inside the loop. P = 'C:\Users\aasyuda\Documents\CV-EIS\aptamer-histamin\14April2023\14April2023\0p0001nM';...

3年弱 前 | 0

回答済み
Writing txt files accurately with a restriction on the number of columns.
V = randi(123,1,23) T = sprintf('%g,',V); U = regexprep(T,'(.{1,13}),','$1\n'); % e.g. max 13 columns fprintf('%s',U) And if...

3年弱 前 | 2

回答済み
How do I put spaces before a line in a txt file using strcat and fprintf?
STRCAT removes whitespace characters. The easy and robust approach is separate FPRINTF calls: fprintf(fid_wrt,' \n') fprintf...

3年弱 前 | 0

| 採用済み

回答済み
Generate comma separated list in single line of code?
A one-line approach that has been possible since R2019b: struct('x',{'A','B','C','D'}).x https://www.mathworks.com/help/releas...

3年弱 前 | 0

回答済み
compare variable with different data types
Here is a neat approach that also allows case-insensitivity: x = 'Yes'; % x can be char, string, logical, or numerical if strc...

3年弱 前 | 0

| 採用済み

回答済み
Concatenate all arrays from a field in a structure
Where S is your structure: A = vertcat(S.A) B = vertcat(S.B) etc. https://www.mathworks.com/matlabcentral/answers/1656435-tu...

3年弱 前 | 1

| 採用済み

回答済み
Access and extract table array using for loop
"I need to extract (or access) the data using "for loop". For example, from "ECG", we can extract the data from 0 sec, 10 sec, 2...

3年弱 前 | 0

回答済み
Merging empty vector with double
"if B is empty, I want it to be shown as 9 zeros" A = [1;2;3;4;5;6;7;8;9]; B = []; C = []; C(1:numel(A),1) = A; C(1:numel(B...

3年弱 前 | 0

| 採用済み

さらに読み込む