Answered

Running a large array

You can read and process the file in sections, one section at a time, in a loop, by specifying the start and count input argumen...

Running a large array

You can read and process the file in sections, one section at a time, in a loop, by specifying the start and count input argumen...

21 days ago | 0

Answered

I want to plot same X axis and different Y axis like timing diagram

I don't know what form your variables are in, but here's something: t = 0:0.5:4.5; Vc = [0 1 0 1 0 1 0 1 0]; Vb = [0 0 1 1 0 ...

I want to plot same X axis and different Y axis like timing diagram

I don't know what form your variables are in, but here's something: t = 0:0.5:4.5; Vc = [0 1 0 1 0 1 0 1 0]; Vb = [0 0 1 1 0 ...

21 days ago | 1

Answered

Right now, changing the spinner's value will create a new maze, but the mazes are still 10-by-10. Try running the app to verify this behavior. To fix this, you can use the gr

% Callback function: GridSizeSpinner, NewMazeButton function NewMazeButtonPushed(app, event) % get the spinner's value: ...

Right now, changing the spinner's value will create a new maze, but the mazes are still 10-by-10. Try running the app to verify this behavior. To fix this, you can use the gr

% Callback function: GridSizeSpinner, NewMazeButton function NewMazeButtonPushed(app, event) % get the spinner's value: ...

21 days ago | 0

Answered

Adding a column to a UITable and then using it.

app.StimInputTable.Data.Var4 = app.StimInputTable.Data.Var3./app.StimInputTable.Data.Var2; % ^^^^^ you we...

Adding a column to a UITable and then using it.

app.StimInputTable.Data.Var4 = app.StimInputTable.Data.Var3./app.StimInputTable.Data.Var2; % ^^^^^ you we...

22 days ago | 0

| accepted

Answered

I want to write data at the end of every nth line of a text file

str = readlines(filename); str(4:4:end) = str(4:4:end) + "c"; writelines(str,filename) where "filename" is the abso...

I want to write data at the end of every nth line of a text file

str = readlines(filename); str(4:4:end) = str(4:4:end) + "c"; writelines(str,filename) where "filename" is the abso...

22 days ago | 1

| accepted

Answered

Questions about the input X of pcolor and contourf.

I interpret the pcolor documentation as saying that a rectangular grid and a parametric grid are separate special cases, so the ...

Questions about the input X of pcolor and contourf.

I interpret the pcolor documentation as saying that a rectangular grid and a parametric grid are separate special cases, so the ...

24 days ago | 0

Answered

With a ribbon plot, how to make the ribbons go along each matrix row instead of each column?

If you have some leeway on the x- and y-axis tick locations, you can use ribbon with the tranpose of Z and just alter the axis l...

With a ribbon plot, how to make the ribbons go along each matrix row instead of each column?

If you have some leeway on the x- and y-axis tick locations, you can use ribbon with the tranpose of Z and just alter the axis l...

25 days ago | 2

Answered

Save graphical objects in .mat file for later use

You can use copyobj to copy an existing graphical object (e.g., scatter plot) to another parent (e.g., axes). Here's an example...

Save graphical objects in .mat file for later use

You can use copyobj to copy an existing graphical object (e.g., scatter plot) to another parent (e.g., axes). Here's an example...

25 days ago | 0

| accepted

Answered

With a ribbon plot, how to make the ribbons go along each matrix row instead of each column?

Z=[0,1,2,2; 1,2,3,3; 2,3,4,4; 3,4,5,5]; [m,n] = size(Z); Y = (0:m-1).'; X = (0:n-1).'; Original ribbon plot, for reference...

With a ribbon plot, how to make the ribbons go along each matrix row instead of each column?

Z=[0,1,2,2; 1,2,3,3; 2,3,4,4; 3,4,5,5]; [m,n] = size(Z); Y = (0:m-1).'; X = (0:n-1).'; Original ribbon plot, for reference...

25 days ago | 1

Answered

How can I make a graph like this for ANOVA 2-Way

The code that constructs bpdata takes the table data for each patient in turn and puts it together into a 2-row matrix with a co...

How can I make a graph like this for ANOVA 2-Way

The code that constructs bpdata takes the table data for each patient in turn and puts it together into a 2-row matrix with a co...

25 days ago | 0

| accepted

Answered

How to programmatically change the command window text size?

s = settings; s.matlab.fonts.codefont.Size.PersonalValue = 16;

How to programmatically change the command window text size?

s = settings; s.matlab.fonts.codefont.Size.PersonalValue = 16;

25 days ago | 1

Answered

agrupacion de datos de una tabla

% first, I construct a table similar to yours N = 152709; MeasID = cellstr(char(64+randi(26,N,4))); Time = datetime(randi(30,...

agrupacion de datos de una tabla

% first, I construct a table similar to yours N = 152709; MeasID = cellstr(char(64+randi(26,N,4))); Time = datetime(randi(30,...

26 days ago | 0

| accepted

Answered

How to count the number of non-nan values for combination of multiple variables

% Initial table a = [1;1;1;2;2;2;2]; b = [660; 661; 661; 663; 663; NaN; 663]; c = [1;2;2;5;5;NaN;6]; d = [11;12;NaN; 13; 14;...

How to count the number of non-nan values for combination of multiple variables

% Initial table a = [1;1;1;2;2;2;2]; b = [660; 661; 661; 663; 663; NaN; 663]; c = [1;2;2;5;5;NaN;6]; d = [11;12;NaN; 13; 14;...

26 days ago | 0

| accepted

Answered

What does the syntax matrix(vector) mean?

Indexing. https://www.mathworks.com/company/technical-articles/matrix-indexing-in-matlab.html

What does the syntax matrix(vector) mean?

Indexing. https://www.mathworks.com/company/technical-articles/matrix-indexing-in-matlab.html

26 days ago | 0

| accepted

Answered

Unrecognized function or variable 'RK'.

https://www.mathworks.com/matlabcentral/answers/96005-why-do-i-get-the-error-unrecognized-function-or-variable

Unrecognized function or variable 'RK'.

https://www.mathworks.com/matlabcentral/answers/96005-why-do-i-get-the-error-unrecognized-function-or-variable

26 days ago | 0

Answered

How do I draw contours on multiple surfaces so that they line up

Maybe specifying a vector of contour levels, rather than the number of levels, is appropriate. For example: lev = 0.01:0.01:0.0...

How do I draw contours on multiple surfaces so that they line up

Maybe specifying a vector of contour levels, rather than the number of levels, is appropriate. For example: lev = 0.01:0.01:0.0...

26 days ago | 0

| accepted

Answered

Error using feval Function to evaluate must be represented as a string scalar, character vector, or function_handle object.

Use the 's' (or "s") option in input() in order to store the result as text without evaluating it: fname = input('\n M-file con...

Error using feval Function to evaluate must be represented as a string scalar, character vector, or function_handle object.

Use the 's' (or "s") option in input() in order to store the result as text without evaluating it: fname = input('\n M-file con...

26 days ago | 0

Answered

A problem with a code that works as it is but gives an index error when is used inside a function

Based on the error message, "Index in position 2 exceeds array bounds. Index must not exceed 100. Error in cleaner (line 118) z...

A problem with a code that works as it is but gives an index error when is used inside a function

Based on the error message, "Index in position 2 exceeds array bounds. Index must not exceed 100. Error in cleaner (line 118) z...

26 days ago | 0

Answered

How can I write a 'for' loop that sums up all elements of a vector?

a = 1:5; total = 0; for ii = 1:numel(a) total = total+a(ii) end

How can I write a 'for' loop that sums up all elements of a vector?

a = 1:5; total = 0; for ii = 1:numel(a) total = total+a(ii) end

26 days ago | 0

Answered

Iterate over struct with length>1, with multiple fields

teststruct = struct('name', {'Alice', 'Bob', 'Eve'}, 'age', {24, 45, 35}) names = {teststruct.name} ages = [teststruct.age] O...

Iterate over struct with length>1, with multiple fields

teststruct = struct('name', {'Alice', 'Bob', 'Eve'}, 'age', {24, 45, 35}) names = {teststruct.name} ages = [teststruct.age] O...

27 days ago | 0

| accepted

Answered

How to plot RGB histogram of an image into a single 3D slice plot?

image = imread('peppers.png'); R = image(:,:,1); G = image(:,:,2); B = image(:,:,3); subplot(2,2,1); imshow(image); titl...

How to plot RGB histogram of an image into a single 3D slice plot?

image = imread('peppers.png'); R = image(:,:,1); G = image(:,:,2); B = image(:,:,3); subplot(2,2,1); imshow(image); titl...

27 days ago | 2

| accepted

Answered

i have a vector in lenght 5, i need to check if a sum of 2 or more elements in the vector is equal to another element at the same vector how to do that?

v = [10 5 13 15 28]; m = dec2bin(0:2^numel(v)-1)-'0'; m = m(sum(m,2) >= 2,:); [ism,idx] = ismember(m*v.',v); idx = idx(ism...

i have a vector in lenght 5, i need to check if a sum of 2 or more elements in the vector is equal to another element at the same vector how to do that?

v = [10 5 13 15 28]; m = dec2bin(0:2^numel(v)-1)-'0'; m = m(sum(m,2) >= 2,:); [ism,idx] = ismember(m*v.',v); idx = idx(ism...

27 days ago | 3

Answered

Matrices à coefficients dépendant d'un paramètre

One option: F = @(t)[0,1;t,t^2]; M = F(1) M = F(-1) M = F(2) Another option: syms t M = [0,1;t,t^2]

Matrices à coefficients dépendant d'un paramètre

One option: F = @(t)[0,1;t,t^2]; M = F(1) M = F(-1) M = F(2) Another option: syms t M = [0,1;t,t^2]

27 days ago | 0

| accepted

Answered

Fill in the missing time stamps in measurment data when the system is runnign but not when the system was OFF

Data1 = readtimetable('Data1.xlsx'); Data2 = readtimetable('Data2.xlsx'); Data3 = readtimetable('Data3.xlsx'); Maybe one of t...

Fill in the missing time stamps in measurment data when the system is runnign but not when the system was OFF

Data1 = readtimetable('Data1.xlsx'); Data2 = readtimetable('Data2.xlsx'); Data3 = readtimetable('Data3.xlsx'); Maybe one of t...

27 days ago | 0

| accepted

Answered

Arrays have incompatible sizes for this operation error while checking dropdown.value not equal to a char value

Don't use == or ~= to compare character arrays, use strcmp, i.e.: if ~strcmp(app.SelectBatteryDropDown.Value,'none') because =...

Arrays have incompatible sizes for this operation error while checking dropdown.value not equal to a char value

Don't use == or ~= to compare character arrays, use strcmp, i.e.: if ~strcmp(app.SelectBatteryDropDown.Value,'none') because =...

27 days ago | 0

| accepted

Answered

Function file doesn`t work

T = readtable('Lab5_R_100_MOhm.txt','VariableNamingRule','preserve') f = T.(1); A = T.(2); Ph = T.(3); figure tiledlayout...

Function file doesn`t work

T = readtable('Lab5_R_100_MOhm.txt','VariableNamingRule','preserve') f = T.(1); A = T.(2); Ph = T.(3); figure tiledlayout...

1 month ago | 0

Answered

re-indexing slices of a matrix

A = [1 4 4 4 3 4 6 3 3 3 2 1 3 1 7 2 5 2 9 2 5 1 4 1]; A(:,2) = 1+c...

re-indexing slices of a matrix

A = [1 4 4 4 3 4 6 3 3 3 2 1 3 1 7 2 5 2 9 2 5 1 4 1]; A(:,2) = 1+c...

1 month ago | 0

| accepted

Answered

I am trying to figure out how to use writetable instead of xlswrite, but the feature is converting my numbers to text. Headers are text.

Excel_Sheet = array2table(Excel_out,'VariableNames',Excel_head); writetable(Excel_sheet,'C:\D_Local\MATLAB\AAA\PhaseII_CA_out.x...

I am trying to figure out how to use writetable instead of xlswrite, but the feature is converting my numbers to text. Headers are text.

Excel_Sheet = array2table(Excel_out,'VariableNames',Excel_head); writetable(Excel_sheet,'C:\D_Local\MATLAB\AAA\PhaseII_CA_out.x...

1 month ago | 0

Answered

Selectin elements that satisfy a certain condition with modular arithmetic

N = 6; m = 3; M = dec2base(0:m^N-1,m)-'0'; idx = mod(M(:,1)+M(:,4)+M(:,5),m) == 1 ... & mod(M(:,2)+M(:,5)+M(:,6),m) ...

Selectin elements that satisfy a certain condition with modular arithmetic

N = 6; m = 3; M = dec2base(0:m^N-1,m)-'0'; idx = mod(M(:,1)+M(:,4)+M(:,5),m) == 1 ... & mod(M(:,2)+M(:,5)+M(:,6),m) ...

1 month ago | 0

| accepted

Answered

Not recognizing any text files in folder using dir(fullfile)

Try folder_path = 'C:\users\power\downloads\star capillary files\'; instead of folder_path = 'C:users\power\downloa...

Not recognizing any text files in folder using dir(fullfile)

Try folder_path = 'C:\users\power\downloads\star capillary files\'; instead of folder_path = 'C:users\power\downloa...

1 month ago | 0