Answered
Hi i have a problem i got this error while making program which detect face mask Index in position 1 exceeds array bounds. Error in maskdetection (line 21) rectangle('Pos
Instead of looping over rows of BB and trying to access the corresponding row in NB and MB each time (which may or may not exist...

4 years ago | 0

| accepted

Answered
Specify Square Marker in a Plot
You can break it up into multiple lines: X = (1:25); Y = [2 1 2 2 2 3 1 4 3 2 1 2 3 7 11 8 5 2 3 4 5 8 5 5 7]; fig1 = figure(...

4 years ago | 2

| accepted

Answered
cell arrays not explicited
Here's a table T that matches the screen shot: Dtc = {'P0C43';'P0532';'P1C68'}; Lamp = {'3 trip MIL';'3 trip MIL';'1 trip Wren...

4 years ago | 0

Answered
how to sum cell elements in a dynamic cell table
Is this similar to what you want to do? (Using 5 columns here instead of 16, and using 3 rows.) data = (1:5).*[1;7;20] [L,M] =...

4 years ago | 0

Answered
how to batch save and load loop variable
How about making a a matrix? a = zeros(3,10); for i = 1:3 a(i,:) = rand(1,10); end disp(a); Or, if each iteration prod...

4 years ago | 0

Answered
use of "if" and "elseif" in regionprops
Index score by cnt inside the loop, and don't use the same variable score for the numeric score and the label (#3, #4, etc.) you...

4 years ago | 0

| accepted

Answered
How to generate a 2D meshgrid based on the coordinates (longitude and latitude) of points
xy = [1 3; 2 9; 6 6; 8 8; 9 1]; % [xx,yy] = meshgrid(sort(xy(:,1)),sort(xy(:,2))) % note: maybe you want to sort x and y firs...

4 years ago | 1

| accepted

Answered
Replacing whole row with NaN's if first value is equal to 13 or 15.
Do you mean the value of the first column is equal to 13 or 15? A = randi(20,10,5) idx = A(:,1) == 13 | A(:,1) == 15; A(idx,:...

4 years ago | 0

| accepted

Answered
how to slice a 3d array with slider?
Here's one way to do that: clear all clc y = randn(10,10,10); N = size(y,3); h = uicontrol( ... 'style','slider', ...

4 years ago | 0

| accepted

Answered
How to save function as f.m?
Are you able to click "Save As..." and then, in the Save dialog window that pops up, change the "Files of Type:" from .mlx to .m...

4 years ago | 0

Answered
add a row of summary statistics in a table
t = table({'new york';'chicago'},[10;5],[17;18],'VariableNames',{' ','visitor','temperature'}) t(end+1,:) = {'' sum(t{:,'visito...

4 years ago | 0

| accepted

Answered
Difficulties having log and linear y axes on same figure
This is your code, with some random data. It seems to do the right thing, as far as the axes scales (linear/log) being correct. ...

4 years ago | 0

Answered
Why is my function not graphing in the plot?
Just like you use element-wise operations .* and .^ for multiplication and exponentiation, respectively, you must also use eleme...

4 years ago | 1

Answered
How can I open an .m script from the GUI panel in a new Matlab editor window?
Does this work? function edit_data_Callback(src,evt) % "Edit data" button's Callback function file_name = 'my_script.m'; ...

4 years ago | 0

| accepted

Answered
six pointed star
th = 0:30:360; r = [1/sqrt(3) 1]; r = r(1+mod(1:numel(th),2)); plot(r.*cosd(th),r.*sind(th)) axis square

4 years ago | 1

Answered
Defining adjacent number repetitions in a random matrix
A = randi(8,6,32); disp(A); N_rows = size(A,1); while true idx = cellfun(@(x)strfind(x,[0 0]),num2cell(diff(A,1,2),2),...

4 years ago | 0

Answered
Restructuring table - converting row values to columns
% creating a table like the one you have: Parameter = strcat('text',sprintfc('%d',[1 1 1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3]).'); O...

4 years ago | 0

Answered
Stacked plots: display two variables on the same x-axis
You can use subplot/tiledlayout with yyaxis, and then set the relevant axes properties to make the display more like what you ge...

4 years ago | 0

| accepted

Answered
how to solve this
r = pi^1/3-1 % == (pi^1)/3 - 1 == pi/3 - 1 A = pi*r^2 r = pi^(1/3)-1 % pi to the one-third power, minus one A = pi*r^2

4 years ago | 0

Answered
how to use conditional statement realizing prime function
Your driver code is calling isPrime two times. % driver code n = 9; The first time, you only get a disp(b) from inside isPrim...

4 years ago | 0

| accepted

Answered
if pushutton1 is pressed, how to use the value associated with it for displaying result for pushbutton2 in GUI ?
If you want to prevent the user from changing the value in the 'a' edit box, you can set the 'Enable' property of that edit box ...

4 years ago | 0

| accepted

Answered
Want to weight Histogram entries by value
data = [ 23 2 12 2 85 3 38 3 12 4 09 2 97 4 ]; [groups,group_ids...

4 years ago | 0

| accepted

Answered
How to take the square of every single value in the code below
Use {} to get the values out of the table: for i = 1:numel(N); data = readtable( fullfile(P, N{i}) ); % read the csv files...

4 years ago | 1

| accepted

Answered
Remove more than two consecutive NaNs and delete the same rows from the date column in a table
% a table with 2 columns, containing some NaNs in the second column: data = (1:20).'; data([2:3 7:9 13 15:19]) = NaN; workDat...

4 years ago | 0

| accepted

Answered
How to have a common colorbar for all tiledlayout plots?
You can calculate the min and max value of A and B together and set the CLim of both axes to those values using the clim (former...

4 years ago | 0

| accepted

Answered
my plot is right for one date but not for other
You neglected to take the absolute value of ER/E before squaring. (Notice the warning you got that imaginary parts of complex va...

4 years ago | 0

| accepted

Answered
Reading text file with variable name
One way, using file_number in the file name: file_number=[1 1 1 2 2 2 3 3 3 4 4 4 1 1 1 2 2 2 3 3 3 4 4 4]; for ii = 1:numel...

4 years ago | 0

| accepted

Answered
Separate a matrix into bins based on first column values
load('DataRoll.mat') plot(DataRoll(:,1),DataRoll(:,2)) % plot all data for reference grid on set(gca(), ... 'Box','on', ...

4 years ago | 0

| accepted

Answered
Error when creating table
If you try creating the table without the RowNames you'll see that your table actually has one row, and each element of the tabl...

4 years ago | 2

| accepted

Answered
How to check for a custom property in a table
isprop should work: t = array2table(rand(10,3)); isprop(t.Properties.CustomProperties,'LineWidth') isprop(t.Properties.Cust...

4 years ago | 0

Load more