Answered
Why am I getting error "Vectors must be the same length" although they are of same length?
load('subject_data.mat') disp(subject_data) % There are 2 Trial40's in the table: find(subject_data.trialname == 'Trial40') ...

4 years ago | 1

| accepted

Answered
Using if-else statement to determine which value to input into function
t = max(samplegrades(:,2),samplegrades(:,3)) The if doesn't work as you expect because, when using an array condition in an if ...

4 years ago | 0

| accepted

Answered
Can't get matlab to run a .exe file...
Try putting double-quotes around the paths contained in exec_path (i.e., the path to the exe and the directory sent to the exe a...

4 years ago | 1

Answered
Grouping users into 3 groups using for loop and if statements
It seems like you should not be using two loops. That'll do the counting for every combination of i and k. Instead it seems like...

4 years ago | 1

| accepted

Answered
Trying to sort unique values in cell array based on different column
test = {'Type1', 'Type1', 'Type2', 'Type2', 'Type2', 'Type3', 'Type4', 'Type4', 'Type4', 'Type4', 'Type4', 'Type5', 'Type5', 'Ty...

4 years ago | 0

| accepted

Answered
How can I extract a field from a matrix of structs, preserving the shape of the matrix?
% create a 2d array of structs S: S = struct( ... 'field1',{0.96 0.33 0.61; 0.11 0.26 0.93}, ... 'field2',{0.55 0.16 ...

4 years ago | 0

Answered
Remove the duplicated vector in the array
A = [1 3; 1 4; 1 3; 1 4; 2 3; 3 4; 3 4; 3 5; 4 5]; new_A = unique(A,'rows')

4 years ago | 1

| accepted

Answered
how can i create a column vector with specific values?
vec = [0; (63:-1:1).']

4 years ago | 0

| accepted

Answered
why i can't delete a surface 3d plot (fsurf i mean) whereas i can delete a plot. If it can be, how can i do that
In order for the surface to be accessible in function calls subsequent to the one in which it is created (e.g., to delete the su...

4 years ago | 0

Answered
How to use arguments of other m-file in another m-file?
% get the outputs from A: [a1,a2,a3] = A(5); % use them as inputs in B: result = B(a1,a2,a3) function [out1,out2,out3] =...

4 years ago | 0

Answered
Getting the ratio of consecutive links in network using loop.
A = 1:9; % unused B = [2 10 5 8 12 6 14 6 2]; B_ratio = [NaN B(2:end)./B(1:end-1)] % no loop necessary

4 years ago | 0

| accepted

Answered
Create a matrix with one vector
v=[1,2,3,4]; N = numel(v); idx = max(1:N,(1:N).'); M = v(idx)

4 years ago | 0

| accepted

Answered
How to pad NaNs in a matrix having small size to make equivalent with matrix of large size?
A = [1 2 3; 4 5 6; 7 8 9]; B = [1 2; 3 4]; [ma,na] = size(A); [mb,nb] = size(B); % one way: B_new = [B NaN(mb,na-nb); N...

4 years ago | 0

| accepted

Answered
pop up menu regarding
function file_name = get_mat_file() h = struct(); h.fig = figure( ... 'Units','pixels', ... 'NumberTitle','off',...

4 years ago | 0

Answered
Vectorization of nested for loop
% random matrix G: G = rand(200,3); [r,m] = size(G); % parameter: n = 4; % for loop method (generalized): L=zeros(n,r,...

4 years ago | 0

| accepted

Answered
I am having trouble outputting the correct rating when inputting the same value for R(rivalry game) and B(bowl game). The output also doesnt consider the # of wins. Any help?
SeasonsFunction(2,false,false) SeasonsFunction(4,true,false) SeasonsFunction(7,true,true) SeasonsFunction(9,true,false) Seas...

4 years ago | 0

Answered
Delete the values from array using histogram
arr(deleted_data_idx,:) = [];

4 years ago | 0

| accepted

Answered
How to export data displayed from uitable on GUI MATLAB to Microsoft Excel?
Since it appears that your MATLAB version may be older than writecell and too old to make convenient use of writetable, here's h...

4 years ago | 0

| accepted

Answered
How can I graph data from a database in my program
property.propertyprice and property.Address are both strings. It's possible to remove the $ and , characters from the prices and...

4 years ago | 0

Answered
How to take function as an input and differentiate it( str2func not working) ?
Use str2sym instead of str2func syms x; % y = str2sym(input('Enter one variable wquation, e.g @(x)2*x - 3: ', 's')); y = str2...

4 years ago | 0

| accepted

Answered
Find pattern in vector while ignoring/skipping certain indices
% the pattern: pat = [0 4 NaN 0 6 NaN 0 8 NaN]; % create some data containing the pattern: data = randn(1,10000); idx = fi...

4 years ago | 0

Answered
Iterating over array in pair-wise manner and calling function with two args and taking max over all pairs
The problem is these lines: region1 = regions(i); region2 = regions(j); Since regions is a cell array, the above lines of cod...

4 years ago | 1

| accepted

Answered
How to compare the last updated value with the previous values in the array that is concatenated(row-wise) continuously with the new data?
Here is something that mimics the situation in your code, as I understand it. This builds the n-by-2 matrix A row-by-row and eac...

4 years ago | 1

| accepted

Answered
how can i organize a column vector in a specific rows?
x = (1:1536).'; reshape(x,24,[]).'

4 years ago | 0

| accepted

Answered
minimun value in a column matrix with its index
A(A~=0) is a 4-by-1 vector: A=[0; 5 ;6 ;9 ;55]; A(A~=0) When you do min on that you find that 5 is the minimum, which occurs ...

4 years ago | 1

Answered
I want to plot this semi circle
I'm not sure where a equals 22 degrees comes from. That semicircle corresponds to an angle of 90 degrees to 270 degrees. Settin...

4 years ago | 0

| accepted

Answered
mean of rows across columns in matrix
M = rand(2,400,145); % random array new_M = [M; mean(M,1)]; % append the mean of row 1 and 2 to the end, to make new_M siz...

4 years ago | 0

| accepted

Answered
How to set clipping of text in graph from all sides, so it stays in requested area
You can achieve partial text clipping by setting the 'ClippingStyle' property of the axes to 'rectangle': xy = [0.95, 0.8]; pl...

4 years ago | 2

| accepted

Answered
How can I display numeric value (that is percentage) in edit text by using pushbutton?
First, what is the intent of these lines? seg = handles.segmentedImage; seg = imbinarize(I,graythresh(I)); If the intent is t...

4 years ago | 0

| accepted

Load more