Answered
How to acess data if its in cell form?
Use curly braces { } to access the contents of tables T = table( ... {'patient1';'patient2';'patient3'}, ... [25;45;1...

4 years ago | 0

Answered
Find heights of tables within an MxN cell
load('matlab.mat'); table_heights = cellfun(@height,ArrayPR); disp(table_heights)

4 years ago | 0

| accepted

Answered
Difficulty using 'readvars' function in a loop with different dimensions of data in the files
I'm unable to reproduce the error with readvars itself, but I can generate that error on the same line as where readvars is used...

4 years ago | 0

| accepted

Answered
Add push button to GUI to be able to change image for color thresholding in image processing and save button to save images
When the function Pushbutton is executed, the selected file is read and new images are created in each of the two axes, using im...

4 years ago | 0

Answered
How to ask the user to input a several membership functions with their names?
You might do something like this: number = input('Input the number of terms for this input: '); c = cell(2,number); for i = 1...

4 years ago | 0

Answered
Draw a circle inside a black image
E = zeros(500,500); E2 = insertShape(E, 'Circle',[250 250 100], ... 'Color','white', 'LineWidth',5); figure(5); % ims...

4 years ago | 1

| accepted

Answered
Returning an array of colors from a double image
% create an image with colors r,g,b,w,y im = ones(2,4,3); im(1,1,:) = [1 0 0]; im(1,3,:) = [0 1 0]; im(2,2,:) = [0 0 1]; im...

4 years ago | 0

Answered
how to plot this programme
Try changing this y = fcs(i) plot(y) to this plot(fcs)

4 years ago | 0

| accepted

Answered
There is something wrong in this script because when I run this program it shows file:line:1, coloum:1 invalid use of operator
Use " % " to create a comment in MATLAB code. Then use " .^ " rather than " ^ " when operating element-wise on an array (and us...

4 years ago | 0

| accepted

Answered
Struggling with logical operators in an 'if' statement. Need to use AND and OR.
% If (X1 = 255 OR 254) AND (X2 = 0 OR 1 OR 2) AND (X3 = 0 OR 1 OR 2) then... if (X1 == 255 || X1 == 254) && (X2 == 0 || X2 == 1...

4 years ago | 0

Answered
Divide each column by a constant from a vector
A = randn(150000,8); B = randn(1,8); C = A./B; % this should be all you have to do* size(C) *In older versions of MATLAB, ...

4 years ago | 0

| accepted

Answered
MATLAB code requires a loop explanation
% T=xlsread('ali.xls','temp','C:C'); T = (1:100).' n=length(T); yt=n/12; for i=n:-1:1 % this for loop populates the matrix X...

4 years ago | 2

Answered
how to save values in a matrix from a loop
To handle the case that not all rows of x have the same number of unique values, you can make y a cell array and construct each ...

4 years ago | 1

| accepted

Answered
I made a recursive code to print a tree but the tree is printed backwards
Affarbre_right(5,5) Affarbre_left(5,5) function Affarbre_right(n,N) if n > 0 for j = 1:(N+2) if abs(N+2-j) < n...

4 years ago | 0

Answered
how I can to get the effective value of voltage(Ture RMS) with the following formula by "for loop"?
t = 0:0.0001:0.3; f = 50; % Hz Vm = 1.4; % volt sag = 0.2*Vm; % voltage sag in 0.1<t<0.2 V = Vm*sin(2*pi*f*t); idx = 0.1...

4 years ago | 0

| accepted

Answered
How can I get the mean value of 1st 10 values of a cell array
To take the mean of the first 10 elements of each matrix and handle the case that there are fewer than 10 elements some of the m...

4 years ago | 0

| accepted

Answered
How do you write a filepath into a table?
file_names = { ... 'C:\Users\JY\Desktop\Weather\Monday\Overcast.csv' 'C:\Users\JY\Desktop\Weather\Tuesday\Sunny.csv' ....

4 years ago | 0

| accepted

Answered
How to share data with a running callback in an App Designer app?
Try including a drawnow() inside your while loop, which will update the graphics so that when subesquent code gets the value of ...

4 years ago | 0

Answered
accessing single function from an array of functions
a = @(t)(1+0.8*sin(2*pi*t)); b = @(t)0.8*(1-0.8*sin(2*pi*t)); z = @(t)0*t; %T = matlabFunction(fmat); % T is a function ...

4 years ago | 0

Answered
New Line in text file from Matlab
% random numbers for data to write to text file: data = randn(20,10)*1e6; % open the file for writing: fid = fopen('test_ou...

4 years ago | 0

| accepted

Answered
shadow in mulitple line plot
Building on @Les Beckham's answer a little bit (introduce zeros in y to make the patches fill all the way down to the x-axis): ...

4 years ago | 0

Answered
identify consecutive occurrence of 1 in a binary array
You can use strfind() to find runs of consecutive 1's: A = [0,0,0,0,1,1,0,0 ... 1,0,1,1,1,1,0,0 ... 0,1,1,0,1,0,0,1...

4 years ago | 1

Answered
How can I delete certain rows of a matrix based on the first time one column is different from zero
When you say "the first time column 8 is equal to 1", do you mean "the first time that column 8 is equal to 1 after the first ti...

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.
You can use strfind() to find a pattern in a vector like this. Use pattern [0 1] to find where the 1's start, and use pattern [1...

4 years ago | 1

Answered
Subplot and additional spacing?
% create some subplots with varying TightInsets: figure('Color','g'); % (color the figure to see its extent in the plots here i...

4 years ago | 1

| accepted

Answered
Error when creating legend
Maybe you meant to do this: data = randn(1,10); [amp,idx] = max(data); plot(data); hold on plot(idx,data(idx),'o'); legend...

4 years ago | 0

Answered
Error when creating legend
If the RMS line is in the axes, then its legend entry should show up: t = (1:500)*1e-8; signal = randn(1,numel(t)); [amp,idx]...

4 years ago | 1

| accepted

Answered
How can I manipulate with fields in structure.
You can use structfun() for that: % creating a struct like yours but with only 3 fields: s = struct('field1',zeros(44,1),'fiel...

4 years ago | 0

| accepted

Answered
Extract specific rows from a table, row names are dependent on user input.
It's not clear exactly what you want to do, but you can refer to the following: % create a 5x5 table with random integers betwe...

4 years ago | 0

| accepted

Answered
Checking rows of array for one of a set of values
Use ismember(): myMatrix = [0,0,0;0,0,1;0,0,0;0,0,2;0,0,0;0,0,1;0,0,0;0,0,2]; checkFor = [1,2,3]; ism = any(ismember(myMatrix...

4 years ago | 0

| accepted

Load more