回答済み
For loop only running once
V = {'empty';'occupied'}; X = isnat(deptime(:,1)); T = V(1+X)

約3年 前 | 0

回答済み
How to overwrite matrix in txt file with another matrix?
Assuming that the //Events block always occurs last in the text file. Lets start by looking at the content of the two files: ty...

約3年 前 | 0

回答済み
MATLAB not sorting the text files in order.
You can DOWNLOAD and use my code NATSORTFILES: https://www.mathworks.com/matlabcentral/fileexchange/47434-natural-order-filenam...

約3年 前 | 0

| 採用済み

回答済み
60 years of daily data; need to group separately by month and year
The simple MATLAB approach using GROUPSUMMARY and UNSTACK: M = categorical(datetime(1,1,1,"Format","MMM"):calmonths(1):datetime...

約3年 前 | 0

回答済み
reorder data in a matrix
This code finds all permutations with the minimum absolute difference as you specified here: A = [1,0,0,1,0; 1,1,0,0,0; 0,1,1,0...

約3年 前 | 0

| 採用済み

回答済み
FOR loop count to the end but the length of the array is different
"so there is no way to have the output vector with directly length of 5 ?" Of course there are multiple ways to achieve this, h...

約3年 前 | 0

| 採用済み

回答済み
How to combine multiple numbers into 1 number?
General solution: R1 = 2; R2 = 4; Zr1 = [0,0,0]; V = [R1,R2,Zr1]; N = 10.^(numel(V)-1:-1:0) * V(:)

約3年 前 | 0

| 採用済み

回答済み
Load files from two different folders
Do NOT use ADDPATH or CD or any other messing around with the MATLAB search path just for acessing data files. All MATLAB funct...

約3年 前 | 0

| 採用済み

回答済み
how get second derivative of a function with one variable? I keep getting not enough input arguments?
"it seems I did everything according to tutorials" Sort of: you defined a function that works on numeric data, but then you hav...

約3年 前 | 0

回答済み
Creating a graph of |sin(x)|
fun = @(x)abs(sin(x)); fplot(fun)

約3年 前 | 0

| 採用済み

回答済み
How to make random voids with for loop?
Why not just use a loop, something like this (aircode): % ... other model settings S = "e" + (1:10); for k = 1:numel(S) ...

約3年 前 | 0

| 採用済み

回答済み
Problem with writing datestr converted date time to a text file alongside other numeric variables
Have a look at this line: meteo = [DateTime(i,:) DOY(i,:) Ta_1_1_1(i,:)-273.15 TA_1_2_1(i,:)-273.15 Ts_1_1_1(i,:)-273.15 Ts_2_1...

約3年 前 | 0

| 採用済み

回答済み
Find data after 'matched' regular expresion in a file
The file you uploaded is encoded as UTF-16 LE with a BOM: https://en.wikipedia.org/wiki/UTF-16 https://en.wikipedia.org/wiki/B...

約3年 前 | 0

| 採用済み

回答済み
How to iterate over a char array and store them into a separate array?
"I want to be able create an array for each of these data structs ..." The simple approach is to use the structure array which ...

約3年 前 | 0

回答済み
Please help, I keep getting this error... Error using plot Not enough input arguments.
Rather than fiddling around with text and tickmarks, let MATLAB do it for you: V = [33.677;76.714;69.677;64.800;49.871;59.533;4...

約3年 前 | 0

回答済み
Concatenate cells of a cell array rows into single cell
Use NUM2CELL: C = [repmat({'a'},3,1), repmat({'b'},3,1), repmat({'c'},3,1), repmat({'d'},3,1)] C2 = num2cell(C,2).'

約3年 前 | 0

| 採用済み

回答済み
Save all values of a calculation through a loop in a file
"How can I save all the results for each calculation in the mat file?" The standard, efficient, simple approach is to store the...

約3年 前 | 1

| 採用済み

回答済み
How to combine the data from multiple netcdf files and make it one .mat file?
Do not expand/concatenate the data inside the loop! A more robust & efficient approach: concatenate once after the loop: S = d...

約3年 前 | 1

回答済み
Execution of script as a function is not supported
The problem is that you named the script mix_2d_lp_fonc Then when the script gets to this line: fcn_handles = mix_2d_lp_fonc(p...

約3年 前 | 0

| 採用済み

回答済み
Read multiple .mat files and process them
"As you said in my case the variable's name changes on each iteration of the outer loop." With changing variable names you will...

約3年 前 | 1

| 採用済み

回答済み
Looping through sets of names for a match and selecting variable with this name
replace if xx == ID with if strcmp(ID,accvectors_name{xx}) "There is certainly something wrong because instead of a value be...

約3年 前 | 1

回答済み
how to extract table data in structure using multi variables in its path
The simple solution is to always LOAD into an output variable, which itself is a scalar structure. For example: F = 'C:\Users\E...

約3年 前 | 1

| 採用済み

回答済み
For loop to store one matrix from multiple files to a structure
P = 'C:\Users\Document\Data'; S = dir(fullfile(P,'*.mat')); for k = 1:numel(S) F = fullfile(S(k).folder,S(k).name); ...

約3年 前 | 1

回答済み
Creating cell array from multiple structs that has struct components directly accessible?
Your code would be simpler and more robust if you had given every structure exactly the same name. Rather than forcing meta-data...

約3年 前 | 0

回答済み
When mapping smaller arrays to a bigger array, how do I have overlapping elements be added?
A = ones(4,4); B = ones(4,4); C = blkdiag(A,0,0)+blkdiag(0,0,B)

約3年 前 | 1

| 採用済み

回答済み
How to read a specific value next to a text in a text file?
raw = strtrim(readlines('Txt.txt')); idx = strcmp(raw,'')|strcmpi(raw,'Zone,'); raw(idx) = []; % split the values and keys: ...

約3年 前 | 0

回答済み
""Unrecognized variable name 'Time'" I am getting this type of error during ploting , how I can fix this?
The files are formatted slightly differently, as these screenshots show: The READTABLE() documentation gives some options t...

約3年 前 | 1

回答済み
ind2sub with arbitrary martix
"In the example below: how to set the three output arguments [I1 I2 I3] "automatically" ?" You use a comma-separated list: htt...

約3年 前 | 2

| 採用済み

回答済み
Truncate strings to maximum length
str = ["", "ab", "1234", "cdefgh"]; out = regexprep(str,'^(.{1,4}).*?$','$1') % LEFT out = regexprep(str,'^.*?(.{1,4})$','$1')...

約3年 前 | 1

回答済み
Converting Table Output from 1 Format to Another
T = cell2table({'28/0.85','XHHP15AA001';'43/0.85','XHHP17AA001';'24/1.35','XHHP18AA001';'34/1.35','XHHP19AA001'},... 'Varia...

約3年 前 | 0

さらに読み込む