Answered
Create table from array in a loop
"to collected data so that these can be grouped in 5mm groups according to a Diameter values." The MATLAB approach would be to ...

4 years ago | 0

| accepted

Answered
How to use the output of a nested function in parent function?
If you define a function with output arguments and you then want to get those outputs then of course you will also need to call ...

4 years ago | 1

| accepted

Answered
how to input variables?
t = a./(b.^c) % ^ you forgot this Read this to understand the difference: https://www.mathworks.com/help/matlab/matlab_pro...

4 years ago | 0

| accepted

Answered
Selecting Mondays from a Timetable or Table using the datetime object
By default DAY returns the day of the month, so you need to specify its second argument like this: d = day(t,'dayofweek')

4 years ago | 0

| accepted

Answered
How can I divide a given range of three values into equal subparts like abc=[initial_values, mid_value, last_value] and expand the range into a total of 9 or 12 values?
The MATLAB approach is to use INTERP1, because what you ask about is exactly what interpolation is for: x = [80,160,240]; y = ...

4 years ago | 0

Answered
How to create this patterned matrix?
N = 8; M = toeplitz(0:N-1,[0,N:-1:1]); M(N,:) = N:-1:0

4 years ago | 0

| accepted

Answered
Regexp expression to handle changing format
You can easily make a group optional or occur a specific number of times using any suitable quantifier, for example: (..)? % ze...

4 years ago | 0

Answered
Find if two elements are in a row of a matrix
A = [1,3,7]; B = [1,8,3;1,2,3;3,4,5;1,7,9;2,1,3]; V = find(sum(ismember(B,A),2)==2)

4 years ago | 0

| accepted

Answered
How to store the non zero value from each column of a matrix as a column vector (but if there is only zeros on the column store zero) in each iteration?
The simplest solution is probably to use MAX: M = [0.38,0,0;0,0,0;0,0.58,0.71;0,0,0;0,0,0] V = max(M,[],1).' An example where...

4 years ago | 1

| accepted

Answered
How to save mat file using save() with a different variable name using for loop
"How to save mat file using save() with a different variable name using for loop" That rather poor data design that seems to be...

4 years ago | 0

Answered
How to read data using "regexp" function, even when there are occurrences of missing values.
Replace + with *, for example: (?<var1>\w*) % ^ I also simplfied your code and fixed some other bugs: str = fileread...

4 years ago | 0

| accepted

Answered
"ReadTable" column reading error/bug?
Simpler and more efficient: T = readtable('Attept2Pipeline_Perinuclear_Ring.csv', 'Delimiter',',') T = readtable('Attept2Pipel...

4 years ago | 0

| accepted

Answered
I want to get how many times a value sequence is repeated in a column and the average number of times it repeated in a sequence.
"suppose i have a column" V = [0;0;0;0;0;0;0;0;0;1;1;1;1;0;0;0;0;0;0;0;1;1;1;0;0;0;0;0;0;0;1;1;1;0;0;0;0;1;1;1;1;0;0;0;0;0;0;1;...

4 years ago | 0

Answered
How to save all outputs that are produced from each iteration in separated cell in one row of array and each row expresses an iteration then store it in one .mat file?
Pd = {}; [Pd{1:7}] = ndgrid([0.5,1]); Pd = reshape(cat(8,Pd{:}),[],7).'; C = 5*Pd; % M = your code is unclear save('cases....

4 years ago | 0

| accepted

Answered
How to use 1 column and all rows from a matrix in each iteration?
for k = 1:size(M,2) M(:,k) end

4 years ago | 1

| accepted

Answered
Stacking diagonal matrices generated from rows of other matrix
The simplest approach is probably just to use an intermediate cell array: N = 4; M = magic(N); C = cell(1,N); for k = 1:N ...

4 years ago | 0

| accepted

Answered
Obtain multiple function handles as outputs from one single function for optimisation.
Get rid of FIRST_FUNC. Move all of the code that depends on x to SECOND_FUNC. Something like (untested, but should get you sta...

4 years ago | 0

| accepted

Answered
Can I import multiple sheets from one excel file using for loop?
"Is it possible to get different individual output tables equal to the number of sheets within the original excel file for furth...

4 years ago | 1

| accepted

Answered
How to add the same headers to all matrices in a loop
If you really want to use MATLAB efficiently and make processing your data easier then: use indexing rather than dynamically na...

4 years ago | 0

| accepted

Answered
How to split a column with numerical values?
Here are two robust MATLAB approaches (both much more robust than blindly using STRUCT2ARRAY): S = load('data.mat'); ICCs = S....

4 years ago | 1

| accepted

Answered
I want to put numbers from 1 to 8 after the file name using 'for loop' and save this file name as a variable.
"In this way, I want to store each of them in a variable." That would be a very inefficient use of MATLAB. MATLAB is designed t...

4 years ago | 0

| accepted

Answered
Split an array using specific points
Simpler and more efficient than what you are attempting (although most likely you don't realise that yet): Y = [5;2;3;6;7;9;5;5...

4 years ago | 2

| accepted

Answered
How can i divide the data in rows in MATLAB
The solution is very simple: use TRANSPOSE, RESHAPE, TRANSPOSE. Why is TRANSPOSE required? Because of the order that arrays are...

4 years ago | 0

| accepted

Answered
How use Vlookup in matlab?
"How use Vlookup in matlab?" MATLAB uses a simpler yet more powerful and more versatile concept called indexing: https://www.m...

4 years ago | 0

| accepted

Answered
My Matlab code no longer works on my Apple M1 Mac
Cause: there is a DIR somewhere before the code you show: DIR finds no files matching the given filename pattern, so FILENAMES i...

4 years ago | 0

Answered
Assigned small array values into Big array using for loops
per = repelem(temp,4) Or if it is required to use some indexing: per(:) = repelem(temp,4)

4 years ago | 0

| accepted

Answered
How to index a cell array in a for loop
P = 'data_base'; V = [2,4,5,9,10,12,17,23,25]; N = numel(V); C = cell(1,N); for k = 1:N F = sprintf('icp_sat%d.txt'V(k)...

4 years ago | 0

Answered
My matlab script is throwing an error for array dimensionality. "Arrays have incompatible sizes for this operation."
In lieu of actual information, assuming that all input arguments are scalar: Shaft_deflection_calculation(1,2,3,4,5,6) The cau...

4 years ago | 0

| accepted

Answered
Unable to load multiple mat files
theFiles is already a structure, there is no point in creating another one when you can use theFiles already: myFolder = 'C:\Us...

4 years ago | 0

Load more