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

23 giorni fa | 0

| accettato

Risposto
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')...

23 giorni fa | 0

| accettato

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

24 giorni fa | 0

| accettato

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

25 giorni fa | 1

| accettato

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

26 giorni fa | 0

Risposto
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']); % ...

28 giorni fa | 0

| accettato

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

28 giorni fa | 0

| accettato

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

28 giorni fa | 0

| accettato

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

29 giorni fa | 0

Risposto
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,[...

29 giorni fa | 1

| accettato

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

30 giorni fa | 0

| accettato

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

circa un mese fa | 1

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

circa un mese fa | 0

| accettato

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

circa un mese fa | 0

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

circa un mese fa | 1

| accettato

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

circa un mese fa | 0

| accettato

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

circa un mese fa | 2

| accettato

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

circa un mese fa | 0

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

circa un mese fa | 0

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

circa un mese fa | 0

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

circa un mese fa | 0

| accettato

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

circa un mese fa | 0

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

circa un mese fa | 0

Risposto
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

circa un mese fa | 0

Risposto
Copy variables into excel smoothly
"So I wonder how I can work around this?" Don't copy-paste data into Excel. The simple, easy, robust approach is to use WRITEMA...

circa un mese fa | 1

| accettato

Risposto
Fill a matrix with another buy keep the original size
A = zeros(5,5); B = rand(3,5); A(1:size(B,1),:) = B https://www.mathworks.com/help/matlab/getting-started-with-matlab.html

circa un mese fa | 1

| accettato

Risposto
Adding to existing date value
"Using caldays does not update the month" Yes, it does: dt = datetime(2023,3,27, 'Format','u-MM-dd') dt = dt+caldays(5) Appa...

circa un mese fa | 0

Risposto
Why is NaN returned when I have all necessary input data?
"Does anyone see my mistake?" Your data has a range of approx 0.166: how many peaks do you expect to get with minimum peak prom...

circa un mese fa | 0

Risposto
How do I change the name of a variable (actually value of a character array) inside a loop?
"I do not see any oher solution then to edit the name while in the loop." What you are asking is just to change some text. This...

circa un mese fa | 0

| accettato

Carica altro