回答済み
Converting an old Matlab code from 2011 to work with newest version
"I have very limited Matlab skills ..." Don't learn from that badly-written code. Use function handles! "This eval([method... ...

3年以上 前 | 1

| 採用済み

回答済み
how to subtract the datetimes
ac = {'12/09/2022 04:28:01 PM'}; bc = {'12/09/2022 04:28:26 PM'}; at = datetime(ac, 'InputFormat','M/d/y h:m:s a') bt = datet...

3年以上 前 | 0

| 採用済み

回答済み
savefigures with filenames from a cell array
You are already calling SPRINTF() to generate the filename, so just provide it with the text input too: vars = {'A','B','C','D'...

3年以上 前 | 1

| 採用済み

回答済み
Hi,how do I merge .txt file date and time column?
This is easy and more efficient using the READTABLE() options: fnm = 'IMM2211.txt'; obj = detectImportOptions(fnm, 'NumVariabl...

3年以上 前 | 2

回答済み
Splitting integers and floating values from a string in MATLAB
Here an approach which returns a table, which might be more useful for accessing your data: T = readtable('ex.txt', 'NumHeaderL...

3年以上 前 | 1

| 採用済み

回答済み
How do I compare a cell array containing string arrays against a string array without using loops?
S = load('answersData.mat'); A = S.tableOfTextByTime.("tweetUniqueMentions") B = S.tableOfUsers{:,1} tic T = vertcat(A{:}); ...

3年以上 前 | 1

| 採用済み

回答済み
How can i create cell array from matrix?
noP = 2; x_set = [50,44,0.03,0.13]; C = repmat({x_set},noP,1)

3年以上 前 | 0

| 採用済み

回答済み
Dot indexing is not supported for variables of this type
IMAGES is a cell array, so you need to use curly braces to access its content: images{ii}.Neighborhood % ^ ^ TITLES is a...

3年以上 前 | 1

回答済み
textscan different number of floating digits
"...but I need to order them according to the last part which is 30.0m 31.65m 33.5m" So why not just sort the filenames? That ...

3年以上 前 | 0

| 採用済み

回答済み
Add string files to a cell array within a loop
Simpler using COMPOSE(): user = 'user'; runs = [1,2,3]; subj = 1; fmt = 'C:\\Users\\%s\\Documents\\BIDS__dataset\\sub-%02d\\...

3年以上 前 | 0

| 採用済み

回答済み
How to extract date, month, year, and time from a table data?
The MATLAB approach is to use YMD() and TIMEOFDAY() and HOURS(): S = ["2016-01-01 00:30:00"; "2016-01-01 01:00:00"; "2016-01-01...

3年以上 前 | 0

回答済み
how to solve not enough input argument error?
Your code is not written to handle cases when s is non-scalar. Your code assumes that s is scalar, but does not check this an an...

3年以上 前 | 0

| 採用済み

回答済み
I want to add a filename to a struct variable.
A better (simpler, neater, more efficient) use of MATLAB is to just collect the logical values inside the loop, and then use bas...

3年以上 前 | 2

| 採用済み

回答済み
Finding index in a set
Simple and efficient: x1 = [0,0,1,0]; x2 = [0,0,0,0]; ix = find(~x1); iy = randi(nnz(ix),1); x2(ix(iy)) = 1

3年以上 前 | 1

| 採用済み

回答済み
Calculate values inside a loop and store them in variables.
Assuming that SUM() returns a scalar: V = [1:10,15:5:50]; C = V; % preallocate for k = 1:numel(V) % loop over indices, not yo...

3年以上 前 | 0

| 採用済み

回答済み
pre-allocation in loop
"However I think I have already done it at least with MATRICI_SIMULATE_nonan." There is nothing like preallocation in your code...

3年以上 前 | 1

回答済み
Problem with defining a path to a MATLAB function
P = '~/Desktop/Data/pat01_t1/'; % do NOT use PATH as a variable name. Brain = load_untouch_nii(fullfile(P,'Brain.nii')); Most ...

3年以上 前 | 1

| 採用済み

回答済み
How to write a .tsv file?
C = {'hello',1;'world',3.14159} writecell(C,'test.tsv', 'filetype','text', 'delimiter','\t') Checking: type test.tsv

3年以上 前 | 0

| 採用済み

回答済み
Creating variables and assigning values from table data
"Is there any way I can create these variables directly from the table data?" Easy, just convert the data to a structure and SA...

3年以上 前 | 0

回答済み
DIR Index exceeds number of array elements
Problem: you have created a variable named DIR, here on this line: dir = pwd; Solution: get rid of that line of code and clear...

3年以上 前 | 0

| 採用済み

回答済み
How do I rectify the error corresponding to the Dimensions of arrays being concatenated no being consistent
Making a wild guess about the wanted output array size: ECG_l = ECG([1,1:end,end],:);

3年以上 前 | 0

| 採用済み

回答済み
scalar matrix operations / vector arithemtics
"but as you can see the result is wrong.." No, I do not see that. I see the default format which has four digits after the deci...

3年以上 前 | 1

| 採用済み

回答済み
Extracting values from a char variable
str = fileread('text.txt') In three separate REGEXP calls (combining may be possible, but only with significant effort and comp...

3年以上 前 | 0

| 採用済み

回答済み
Removing elements of a cell array that start with a specific letter
"What is the easiest way to do this?" Where C is your cell array: X = startsWith(C,'R'); C(X) = []

3年以上 前 | 0

| 採用済み

回答済み
Need help with regexpi expression for multiple variants of the same phrase
https://www.mathworks.com/help/matlab/matlab_prog/regular-expressions.html#f0-42884 You will probably find the 'ONCE' option al...

3年以上 前 | 0

回答済み
How to convert this string to a datetime?
D = ['2003/06/24' '2003/07/10' '2003/07/10' '2003/07/10' '2003/07/18' '2003/07/26' '2003/08/03' ...

3年以上 前 | 0

| 採用済み

回答済み
How to speed up operation in two 'for' loops?
"How can I improve?" In general importing/exporting data is slow. So rather than calling READMATRIX 58732*numel(S) times in a l...

3年以上 前 | 0

| 採用済み

回答済み
How to add zeros diagonally in a matrix?
A = [2,2,1,3,2;1,3,3,1,2;3,1,4,4,1;2,2,1,3,3] S = size(A)+[1,0]; B = zeros(S); B(~eye(S)) = A

3年以上 前 | 0

| 採用済み

回答済み
How to use 'UniformOutput' and 'ErrorHandler' together in 'arrayfun' function?
"Can anyone please check if my code is correct..." It is not: you have called ARRAYFUN() with two output arguments, therefore b...

3年以上 前 | 0

| 採用済み

回答済み
Is it possible to use vertcat with dot notation?
"The error is being caused by the fact that filename is not a struct." FILENAME is a struct (as returned by DIR). Curly brace i...

3年以上 前 | 1

| 採用済み

さらに読み込む