Answered
how to load saved workspace in a custom named variable?
The efficient approach is to use indexing (rather than anti-pattern dynamic variable names): https://www.mathworks.com/help/mat...

6 years ago | 1

| accepted

Answered
converting abbreviation of months to numerical value
ismember makes this easy: >> D = {'mar','apr','nov','may'}; % your data >> C = {'jan','feb','mar','apr','may','jun','jul','aug...

6 years ago | 0

Answered
how do I create a loop for to extract doubles variables from a cell array?
Where raster_data is your cell array: for k = 1:numel(filenames) raster_labels = raster_data{k}; ... the rest of your...

6 years ago | 0

| accepted

Answered
Extracting data from a table that has cells in cells
>> S(1).date = '20200120'; >> S(2).date = '20200120'; >> S(1).id = 1; >> S(2).id = 2; >> S(1).action = [0;0;0;1;0]; >> S(2)...

6 years ago | 1

| accepted

Answered
Split array of sensor data by indexing
S = load('matlab.mat'); T = S.Data.IMU; G = findgroups(T.name); C = arrayfun(@(g)T(g==G,:),1:max(G),'uni',0); You can then t...

6 years ago | 1

| accepted

Answered
What code is it?
"Is there someone recognize the following code..." It isn't code, it is a binary .mat file (just as the text at the start of th...

6 years ago | 0

Answered
store for loop outcomes in matrix
With MATLAB it is generally much better to loop over indices (rather than over data values), then you can simply use those indic...

6 years ago | 0

| accepted

Answered
Importing and Organizing Text File Data
This efficiently reads all of the file data into one structure. [fid,msg] = fopen('Example_File.txt','rt'); assert(fid>=3,msg...

6 years ago | 0

| accepted

Answered
Variable 'KD' is not fully defined on some execution paths
Look at this line of code KD_anterior=KD; and now consider what is the value of KD the second time the function is called. The...

6 years ago | 0

Answered
How to select or group sections of an array without using indexing
>> A = [NaN, NaN, NaN, NaN, 2, 3, 6, 7, NaN, NaN, NaN, NaN, NaN, 4, 6, 8, 8, NaN, NaN, NaN, NaN]; >> X = diff([true,isnan(A),tr...

6 years ago | 0

| accepted

Answered
Assign values of .mat files into matrix
D = 'path to the folder where the files are saved'; S = dir(fullfile(D,'silomodresults*.mat')); C = {}; for k = 1:numel(S) ...

6 years ago | 0

| accepted

Answered
Splitting an array up
Just use mat2cell, no need for reshape: >> M = rand(64,92690); % fake data >> N = 2048; >> S = size(M); >> V = repmat(N,1,fi...

6 years ago | 2

Answered
Subtraction inside a cell array
You will have to get the numeric data out of the cell array before performing any numeric operations on it. Although you did no...

6 years ago | 0

Answered
How to combine the multiple .mat files of ecg to get a single file.
This should get you started: D = 'path to the folder where the files are saved'; S = dir(fullfile(D,'*.mat')); for k = 1:nume...

6 years ago | 1

| accepted

Answered
How to apply if statement in ode45 function?
c = max(0,c);

6 years ago | 0

Answered
Plot function with varying variable
The MATLAB approach is to use logical indexing, e.g.: z = 0:0.1:5; y = 2; f = z*y; idx = z>1; % logical index f(idx) = 2*z(...

6 years ago | 0

Answered
Sorting of points in 2D
Here is some simple code that that works quite nicely for your aerofoil. The code assumes that the top and bottom are both funct...

6 years ago | 1

| accepted

Answered
Why MATLAB asks for "more input arguments" in the function which is to be handled by ode45?
"However, exactly this is the syntax in the MATLAB documentation" I very much doubt that the MATLAB documentation shows any rec...

6 years ago | 0

| accepted

Answered
How to only replot part of a graph?
"Is there a way to only replot the changed point and the curve around it," Yes: you just need to change the XData and YData val...

6 years ago | 0

Answered
floating point arithmetics, mathlab's interpretation of a . after a number
"Why doesn't e yield 0?" Because most of your values cannot be exactly represented using binary floating point numbers. The va...

6 years ago | 1

| accepted

Answered
How to create arrays from repeated matrix raws?
>> A = [1,2,3,4,5;1,2,8,9,10;1,2,13,14,15;11,12,16,27,18;11,12,19,29,21;11,12,22,23,24] A = 1 2 3 4 5 1 ...

6 years ago | 1

| accepted

Answered
Automatically Update Plots on GUI With Multiple Sliders
One simple approach is to have one "update" function in your GUI and call it from each individual callback: function slider1Cal...

6 years ago | 2

| accepted

Answered
Sort() function return wrong values
You are not assigning the sorted matrix to anything. You need to assign it to a variable, e.g.: minCell = minCell(s, :);

6 years ago | 0

| accepted

Answered
Find index of element closest to other index
>> B1 = [0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,1] B1 = 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 1 >> B2 = [1,1,...

6 years ago | 0

| accepted

Answered
How to read multiple image directory with for loop
Rather than fragile string concatenation and ungainly constructs involving int2str or num2str, the neat and efficient MATLAB app...

6 years ago | 1

Answered
how to get the memory address of variable in matlab
Undocumented feature, has been around for many versions: format debug Examples of its usage: https://www.mathworks.com/matlab...

6 years ago | 0

Answered
How to check if a element of a struct is empty?
fun = @(s) all(structfun(@isempty,s)); % check the fields of a scalar structure. idx = arrayfun(fun,Res_All_Meas); % indices of...

6 years ago | 0

Answered
How to rename an image after processing with different parameters
The cause of the problem is that your inner loop repeatedly processes the same string of the cell array Outputs. So you just kee...

6 years ago | 0

| accepted

Answered
how to calculate mean of submatrices in a large matrix and print out a new matrix
>> M = [11,12,13,14;21,22,23,24;31,32,33,34;41,42,43,44;51,52,53,54;61,62,63,64] M = 11 12 13 14 21 22 23 2...

6 years ago | 0

| accepted

Answered
How to effectively check a list of variables for existence and then check "isvector"
"The data are loaded from "mat" files, some may exist but some may not." Once those .mat files are already loaded directly into...

6 years ago | 0

Load more