Answered
Sum of all even index elements of a 1D array
"Why does it output 'No numbers in even positions' when the length of the array is greater than or equal to three and odd?" Bec...

25 days ago | 0

| accepted

Answered
How do I separate a matrix that has a nested matrix in a cell before importing it to Classification Learner?
That does not seem like the best use of XLSX: storing lots of numeric data as long strings of text just makes processing the dat...

25 days ago | 0

Answered
How to avoid linear indexing in operations involving matrices of different sizes
RESHAPE is very efficient, because no data gets moved in memory: A = rand(3,3); B = rand(3,2); idx = logical([0,1,1;0,1,1;0,1...

28 days ago | 0

| accepted

Answered
Unique name detection in table headers
The old-fashioned way: D = {}; % data H = {}; % header fid = fopen('test_data_for_forum.txt','rt'); while ~feof(fid) H{...

28 days ago | 0

Answered
Matlab 'borders' function not working. How to plot world map?
BORDERS is not inbuilt, it is a third-party function. You can download it here: https://www.mathworks.com/matlabcentral/fileexc...

28 days ago | 0

| accepted

Answered
How to filter a cell array from entries from another cell array
cell1 = {'aaa';'bbb';'ccc';'ddd'}; cell2 = {'bbb';'eee';'fff';'aaa';'ccc'}; cell3 = setdiff(cell2,cell1) https://www.mathwork...

28 days ago | 0

| accepted

Answered
How to find month wise mean and std from data of many years
"I think groupsummary is good function but I am unable to do that with my table data." Lets try it: T = readtable('data.csv')...

29 days ago | 0

| accepted

Answered
From a structure with "n" fields which each are a vector, I want to make a vector of length "n" made of the 3rd value of each vector of my structure.
You could use ARRAYFUN to iterate over the elements of a structure (but this will be slower than a well-written loop): file = s...

30 days ago | 0

| accepted

Answered
table2struct(struct2table(s)) does not return s when some fields are cell arrays with a single element
"Is there a way to guarantee that table2struct(struct2table(my_struct)) returns an identical struct array?" No. "Alternatively...

1 month ago | 1

| accepted

Answered
is there a command similar to map() that you can use in Matlab
"In Matlab is there anything similar to this command, can anyone tell me?" MAP is just a very basic kind of interpolation. MATL...

1 month ago | 0

Answered
How can I save the data from my function as a new .mat file?
Change newFilename = fullfile(filepath, name , '_RT.mat'); to newFilename = fullfile(filepath, [name,'_RT.mat']); % ...

1 month ago | 0

| accepted

Answered
fill a matrix within a loop
"tr_x_ch = 2752 is the actual reply" Then tr_x_ch is a scalar. The length of a scalar is exactly 1 (by definition), so your loo...

1 month ago | 0

| accepted

Answered
How to interpolate from a dataset using interp3?
"How to interpolate from a dataset using interp3?" It is very simple: don't use INTERP3. "It's completely unlogical" It is pe...

1 month ago | 0

| accepted

Answered
Unable to use value of type string as an index
"I wanted to get the details corresponding to each chain in separate matrices since all the details are clubbed into one single ...

1 month ago | 0

Answered
How to rearrange 2x5 matrix while keeping the size the same?
Rather than sorting the data, I suspect that you want something like this: x = [1, 5, 9, 4, 8; 3, 7, 2, 6, 10] y = reshape(x,[...

1 month ago | 1

| accepted

Answered
Convert a string array to numbers (RGB triplets)
S = ["0 0 0.17241"; "0 0 1"; "0 0 1"; "0 0 1"; "0 ...

1 month ago | 0

| accepted

Answered
categorical conversion to integer
M = categorical([0,1;1,0]) X = double(M); Y = int8(str2double(categories(M))); Z = Y(X)

1 month ago | 1

Answered
Best way to get date and time inputs from user and save as a datetime variable
No conversion back-and-forth is required: your approach of adding a DATETIME and DURATION object is the correct one. Sadly the D...

1 month ago | 0

| accepted

Answered
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...

1 month ago | 0

Answered
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 ...

1 month ago | 1

| accepted

Answered
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...

1 month ago | 0

| accepted

Answered
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,'[-...

1 month ago | 2

| accepted

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

1 month ago | 0

Answered
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...

1 month ago | 0

| accepted

Answered
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...

1 month ago | 0

Answered
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 ...

1 month ago | 0

| accepted

Answered
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...

1 month ago | 0

Answered
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....

1 month ago | 0

Answered
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

1 month ago | 0

Load more