回答済み
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

| 採用済み

回答済み
Execute script on multiple Files
With many assumptions, e.g. that the required folders are all subfolders of one parent folder. You should also pay attention to...

3年弱 前 | 0

| 採用済み

回答済み
How do I extract data from a structure and put them all in one single array?
https://www.mathworks.com/matlabcentral/answers/1656435-tutorial-comma-separated-lists-and-how-to-use-them S = vertcat(dataTT.D...

3年弱 前 | 0

| 採用済み

回答済み
How to loop through a specific file in various subfolders inside a main folder?
The simple robust MATLAB approach is to get DIR to do most of the heavy lifting. It is very easy for DIR to loop over subfolders...

3年弱 前 | 0

回答済み
Array rows differences and array filling in a loop
No loops required, the simple MATLAB approach is to use NCHOOSEK: A = [1,3;2,5;4,6;7,10;100,150;230,270] P = nchoosek(1:size(A...

3年弱 前 | 3

| 採用済み

回答済み
too many output arguments when calling axis in cellfun
"It has no output argument." Yes, it does. Every expression inside the curly-braces is evaluated and its output is requested. W...

3年弱 前 | 0

| 採用済み

回答済み
Get error about table creating
CAUSE: the bug is caused on this line, where you create a variable named TABLE: table = table(..) After you do that, then TABL...

3年弱 前 | 0

| 採用済み

回答済み
How to find the exact toolbox being used from the license name ?
See the table here: https://www.mathworks.com/matlabcentral/answers/377731-how-do-features-from-license-correspond-to-names-fro...

3年弱 前 | 0

| 採用済み

回答済み
Precision of num2str function
If you want that much control over the text format then you should be using SPRINTF. But in lieu of that, you can specify the f...

3年弱 前 | 0

| 採用済み

回答済み
Extracting arrays from a structure - different number of array elements
"I'm guessing that there is a NaN in one of them." A NaN is scalar, so would not cause this. However an empty array could cause...

3年弱 前 | 0

| 採用済み

回答済み
Processing data from multiple files
"what did i do wrong?" You tried to assign an array into a scalar location. Some of the other indexing will not work either, fo...

3年弱 前 | 1

| 採用済み

回答済み
how can i use struct to "for" when i use predictFcn
"i have 15 number of sturct" And that is a problem which is best solved by putting them into one array (which they clearly shou...

3年弱 前 | 1

回答済み
Making a datetime vector with a leap year
https://www.mathworks.com/help/matlab/matlab_prog/generate-sequence-of-dates-and-time.html D = datetime(2021,1,1); V = D:hours...

3年弱 前 | 0

回答済み
Adding Exponent e.g. 10^_10 to Y Axis (normal code for this doesn't work.)
https://www.mathworks.com/help/matlab/creating_plots/change-tick-marks-and-tick-labels-of-graph-1.html M = 1e10*rand(7,5); plo...

3年弱 前 | 0

| 採用済み

回答済み
find rows in a matrix where all the elements (of those rows) are not NaN
a = [NaN,NaN;NaN,NaN;NaN,NaN;7972,8160;NaN,NaN;NaN,NaN;8083,8343;NaN,NaN;NaN,NaN] b = rmmissing(a)

3年弱 前 | 0

回答済み
How to save Char from Structure into Array MATLAB
S = load('Dataset.mat'); D = S.Dataset T = string({D.ClassName})

3年弱 前 | 1

回答済み
why fread showing too many output arguments?
"So, does that mean 5-values represents 5-different parameters?" Yes, if that is what your file contains and the FREAD command ...

3年弱 前 | 0

| 採用済み

回答済み
get folder names in a directory
Do NOT use CD just to access data files: absolute/relative filenames are more efficient and more robust. Rather than getting th...

3年弱 前 | 0

回答済み
error in loading data from a sheet in .xlsx format
" I do have the sheet but matlab is still give me error." No, as the error message correctly states, there is NO sheet in that ...

3年弱 前 | 0

| 採用済み

回答済み
convert int32 dates to matlab date (datenum)
"Date datatype is int32" You did not tell us the most important information, which is the epoch and step size. Assuming that t...

3年弱 前 | 0

回答済み
sorting data with specific
A = [5,4,3,2,1;6,7,8,9,0]; B = sortrows(A.').'

3年弱 前 | 0

| 採用済み

回答済み
How to properly create for loop with if statement
The simple and efficient approach: L = -180:20:180 L = mod(L,360)

3年弱 前 | 0

回答済み
use unstack to reshape table with dummy variable (edited: alternative crosstab method)
Using UNSTACK is quite a neat solution because it will automatically pad different-length data to the same number of columns, ad...

3年弱 前 | 0

| 採用済み

回答済み
How can I pass a function name into another function?
The functions that you nested inside TESFUN are only visible within TESTFUN: https://www.mathworks.com/help/matlab/matlab_prog/...

3年弱 前 | 0

| 採用済み

回答済み
How to merge new variables and append new rows at the same time (when synchronizing timetables)?
R1 = array2timetable(randi([36 40],5,2),'RowTimes',dateshift(datetime('today'),'dayofweek','Friday',-5:-1),'VariableNames',["x1"...

3年弱 前 | 0

| 採用済み

回答済み
Undefined function 'extractfield' for input arguments of type 'struct' in MATLAB R2023a
"After upgrading from Version 2022b to 2023a today morning, it gives me an error in the exact same code which was running perfec...

3年弱 前 | 0

| 採用済み

回答済み
Extracting datetime and adding reference time
fnm = 'GPS_P01.txt'; txt = fileread(fnm); one = regexp(txt,'(?<=REFERENCE\s*TIME\s*:\s*)[^\n]+','ignorecase','match','once'); ...

3年弱 前 | 0

回答済み
finding a numeric pattern in an array
V = [11,5,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,11,2,31,5,1,2,11,2,31,5,1,2,11,2,31,5,1,2,11,2,31,5,1,2,11...

3年弱 前 | 0

| 採用済み

回答済み
COMBINE MULTIPLE ASCII FILE WITH SIMILAR COLUMN FORMAT OF (X,Y,Z) INTO SINGLE SINGLE FILE OF SAME COLUMN (X,Y,Z)
[F,P] = uigetfile('*.asc','Select the asc-files', 'MultiSelect','on'); F = cellstr(F); C = cell(size(F)); for k = 1:numel(F) ...

3年弱 前 | 0

| 採用済み

さらに読み込む