回答済み
Adding Matrices into main diagonal of Matrix
"As we can see, matrix is not a 10x10 matrix with the main diagonal filled with the intended values above." After calling BLKDI...

約3年 前 | 0

| 採用済み

回答済み
How do I add to a structure in a for loop?
Rather than creating another variable, simply store the imported data in the same structure that you are already using. I also i...

約3年 前 | 0

| 採用済み

回答済み
Preallocating and filling long array with shorter arrays
The simple apparoach is to use a matrix or array, for example: N = 10; M = nan(5,N); for k = 1:N M(:,k) = rand(5,1); en...

約3年 前 | 0

| 採用済み

回答済み
posix/unix time to datetime
Unix time is actually defined as the number of seconds since the epoch. The times you show are the milliseconds since the epoch....

約3年 前 | 1

| 採用済み

回答済み
don't know how to write my for loop
The loop might be clearer iterating from 2, for example: N = 121; % total number of vectors A = rand(21,21); M = nan(21,N); ...

約3年 前 | 0

回答済み
I'd like to skip the file that's not there and bring it up!
A simple alternative approach is to use DIR: S = dir('01__input/NO_*.mat');: for k = 1:numel(S) F = fullfile(S(k).folder...

約3年 前 | 0

回答済み
convert char to table or cell
T = readtable('data.txt', 'Delimiter','|', 'VariableNamingRule','preserve')

約3年 前 | 0

回答済み
count the number a letter appears in a string and plot a histogram
V = categorical(["A","C","G","T"]); W = V(randi(4,1,23)) histogram(W)

約3年 前 | 0

回答済み
Intermediate dot indexing produced a comma-separated list with 34 values, but it must produce a single value when followed by subsequent indexing operations
The documentation https://www.mathworks.com/help/bioinfo/ref/getpdb.html#bq5gvma-2 states the the MODEL field can be a structu...

約3年 前 | 0

| 採用済み

回答済み
How to sort the rows of an array by the total number of zeros in the row
A = [1,0,0;2,0,0;3,0,0;0,1,0;1,1,0;2,1,0;0,2,0;1,2,0;0,3,0;0,0,1;1,0,1;2,0,1;0,1,1;1,1,1;0,2,1;0,0,2;1,0,2;0,1,2;0,0,3] [~,X] =...

約3年 前 | 0

| 採用済み

回答済み
Resample function is not working properly and damaging the signal
It is easy to avoid the loop too, it is just a simple linear interpolation: p = 3; q = 2; tx = (0:p:300-p).'; x = cos(2*pi*t...

約3年 前 | 1

回答済み
Count repetitions separately in an array
A = [1;1;2;2;2;2;2;2;3;1;1;1;1;4;4;4;1;1;1;5;5]; D = diff([0;A;0]==1); B = find(D>0); E = find(D<0); L = E-B X = find(L>2);...

約3年 前 | 1

| 採用済み

回答済み
How to combine two vectors column-by-column?
A = [1,3,5,7;9,11,13,15;17,19,21,23] B = [2,4,6,8;10,12,14,16;18,20,22,24] C = reshape(permute(cat(3,A,B),[1,3,2]),size(A,1),[...

約3年 前 | 1

| 採用済み

回答済み
How to obtain vector of specific values in MATLAB
M = kron(eye(16),ones(6,1)) or M = repelem(eye(16),6,1)

約3年 前 | 2

回答済み
How to set -0.0000 and 0.0000 as zero in matlab?
"Is there a way to keep zeros as zeros? " Zeros are zeros. But the data you show are not zero: the trailing digits tell us tha...

約3年 前 | 0

| 採用済み

回答済み
Reforming index without using loops
Verb % Create a repeating counter with values 1-12 repeating 4 times (48 values total) counter = 1:12; counter = repmat(count...

約3年 前 | 1

| 採用済み

回答済み
How to draw the values of a comma-separated list with 100 values?
Assuming that every field POWERH2COM contains arrays of the same size, and also that every SIM structure contains exactly the sa...

約3年 前 | 1

| 採用済み

回答済み
Find column number for every row in matrix
M = [-1,4,1;1,-1,-1;-5,4,-1] Method one: logical array, CUMSUM, and FIND: X = M>=0; Y = X&cumsum(X,2)==1; [C,~] = find(Y.') ...

約3年 前 | 0

| 採用済み

回答済み
Creating a function to Import data into structures
[TrajX.(trialname),TrajY.(trialname),TrajZ.(trialname)] = Import_Data_Function(vicon,subject,firstframe,lastframe); function ...

約3年 前 | 0

| 採用済み

回答済み
Vertically Concatenating Timetables of Different Sizes
"The goal here is to vertically concatenate each timetable so that all the data within the intersection are aligned by column/di...

約3年 前 | 0

| 採用済み

回答済み
is there any way to convert milliseconds to hh:mm:ss.FFF.
N = uint32(65432) D = milliseconds(N); D.Format = 'hh:mm:ss.SSS'

約3年 前 | 1

回答済み
Working with structures : Unrecognized field name
"Do you have any ideas on how to get around this problem? " Field = fieldnames(s); Dat = s.(Field{1}).data https://www.mathwo...

約3年 前 | 0

| 採用済み

回答済み
how to reverse a matrix (nxm) sorting?
x = rand(3,5) [xs, is] = sort(x,2) Method one: NDGRID and SUB2IND: sz = size(x); [~,ic] = sort(is,2); [ir,~] = ndgrid(1:sz(...

約3年 前 | 1

| 採用済み

回答済み
How to convert time format of file date
"Hello, I want to convert the date string obtained by file.date to the format yyyymmdd_HHMMSS, i.e.," A much simpler and much m...

約3年 前 | 0

| 採用済み

回答済み
subdirectories in a for loop
P = 'F:/PhD/Swan pruebas/Iniciados/regreso/River/MorF Rs (Veg)'; S = dir(fullfile(P,'Output*','file.mat')); S = natsortfiles(S...

約3年 前 | 0

| 採用済み

回答済み
Average product of arrays
T = readtable('pems_rawdata_NB.csv') F = @(c)cellfun(@(t) sscanf(strrep(t,'{',''),'%f,'), c,'uni',0); T = convertvars(T,{'flow...

約3年 前 | 1

| 採用済み

回答済み
Reading data from .txt files from a folder.
To make debugging unexpected data (sizes, types, values) easier, I usually find it easier to concatenate data after the loop: P...

約3年 前 | 0

| 採用済み

回答済み
Vectorising nested for loops
S = load('data.mat') list = S.list tdat = S.table_data k=0; out0 = struct('idx',[],'count',[],'size',[]); for i = 1:size(...

約3年 前 | 1

回答済み
Matlab not recognizing 'fit' function
Have you or any third-party function or toolbox made any changes to the MATLAB search path? Call https://www.mathworks.com/help...

約3年 前 | 1

| 採用済み

回答済み
Remove null rows from a structure before converting to table
S = struct('A',{[],[],1},'B',{[],[],2}) X = arrayfun(@(s)any(structfun(@isempty,s)),S); T = struct2table(S(~X))

約3年 前 | 0

| 採用済み

さらに読み込む