Answered
Writing a summation code where i≠j
The weight matrix is zeros along the diagonal. Thus you can use it as-is in the summation, since the terms where i==j (which cor...

4 years ago | 1

| accepted

Answered
Add data labels to scatter plot
tenFootHorizontal = [2,3,-4,-1]; tenFootVertical = [1,3,0,.5]; scatter(tenFootHorizontal,tenFootVertical,'red','filled'); %...

4 years ago | 0

Answered
Maximun value of a different profiles
It's not clear why you set sm=mm. That will cause the for loop to iterate once, plotting only the last profile. (Maybe that was ...

4 years ago | 1

| accepted

Answered
How to use regexprep to modify strings while keeping constituent numbers intact?
You can capture the V_1, V_2, etc., in tokens, then place those tokens in the output of regexprep by specifying $1 in patternToR...

4 years ago | 1

| accepted

Answered
Trying to have a Matlab line plot with Xticks coresponding to numbers with unequal numerical gap but equal spacing.
It looks like your xticks and xticklabels are ok (except you don't need to set them more than once - you also don't need to do h...

4 years ago | 0

Answered
How to add replay button?
Create a new button: h.replaybutton = uicontrol( ... 'Parent',h.f, ... 'Units','normalized', ... 'Position',[0.8...

4 years ago | 0

| accepted

Answered
Plotting large data set within for loop
[numRows , numCols] = size(D); for ii = 1:numCols/2 figure() plot(D(:,2*ii-1),D(:,2*ii)) title(sprintf('Cross ...

4 years ago | 1

| accepted

Answered
Can't figure out how to find what is wrong with my code
Consider this piece of code at the end: if(option == 6); for(k = 1 : length(inspection) ); printf("%...

4 years ago | 0

| accepted

Answered
I want to concatenate two coloumns of table.
Let's say you have a table t with variables freqa and freqb. freqa = [950; 2000; 3000; 4000]; freqb = [1500; 2070; 3070; 4070]...

4 years ago | 0

Answered
Need help creating a loop that outputs the mean of each row of every 6th column into a new matrix
First, creating some random data: n_subjects = 25; n_variables = 6; n_repetitions = 3; n_conditions = 4; % data_in: 25x73...

4 years ago | 0

| accepted

Answered
How to get all combinations of PRODUCTS between two array elements?
A = [5 6 8 9 7]; B = [3 4 5]; A.*B.'

4 years ago | 0

| accepted

Answered
Convert negative values to zero in timetable
% a timetable with 3 data columns: Holly_NOx = timetable(datetime(now+(-29:-22),'ConvertFrom','datenum').', ... randn(8,1)...

4 years ago | 0

| accepted

Answered
how to make matlab save (filename) command work?
save saves to a mat file, so what is happening when you do this save('untitled2.m') is that a file is created called untitled....

4 years ago | 0

| accepted

Answered
For Loop only showing data for last file within Array
Make data_in a cell array, and store the contents of each file in a different cell of data_in: clear all; clc [file_list, pa...

4 years ago | 0

| accepted

Answered
how to read multiple sheets of excel file using readtablle command. The way we do using xlsread(fileName,'sheet1')
% a = readtable(file, 'Definitions') % not this a = readtable(file, 'Sheet', 'Definitions') % this

4 years ago | 1

| accepted

Answered
Can we change the size of cell inside the cell array?
% a cell array of size 3X6 and each cell contains 6x1 matrix C = cell(3,6); for ii = 1:size(C,1) for jj = 1:size(C,2) ...

4 years ago | 2

| accepted

Answered
can I compare the previous state with current state in " While loop " ?
X_current = 1; X_previous = 0; while true fprintf('current = %4.2f, previous = %4.2f\n',X_current,X_previous); if ab...

4 years ago | 0

| accepted

Answered
Removing scientific notation in log plot
FreqS = 0.1:0.1:20; Tunability2D = rand(1,numel(FreqS)); figure('Name','2D Tunability') plot(FreqS,Tunability2D,'k','LineWi...

4 years ago | 0

| accepted

Answered
non square matrix interpolation matlab (colorgraph)
There is an error in how your matrices X and Y are constructed: nfil and ncol are swapped in those two for loops. It's corrected...

4 years ago | 2

| accepted

Answered
Not enough input arguments. Error in Kapur (line 4) fitR = zeros(1,m);
This error is happens when you run a function by clicking the green Run button in the MATLAB editor, when the function expected ...

4 years ago | 0

Answered
Saving variables in a live editor script to an excel file
Using writecell would probably be the easiest way to do this. You can use 'WriteMode','append' where appropriate. % specify the...

4 years ago | 0

Answered
What is the difference between run, run and advance run to end?
See documentation here: https://www.mathworks.com/help/matlab//matlab_prog/create-and-run-sections.html#mw_eb835312-5b90-4eb9-a...

4 years ago | 0

Answered
Why do i get ""
It's only a warning (not an error), so you don't have to solve it. getInterpolationArrays is written such that xp is construct...

4 years ago | 1

| accepted

Answered
Changing numbers in dataset
Considering that -1 can be written as -1+(0/4), a pattern becomes clear: 1 -> -1+(0/4) 2 -> -1+(2/4) 3 -> -1+(4/4) 4 -> -1+(...

4 years ago | 1

| accepted

Answered
Why this loop is executing 4 times?
SIGMA is of size 1-by-4, and the loop goes from 1 to length(SIGMA) (which is 4), so what else would you expect? SIGMA = 0:0.05:...

4 years ago | 0

| accepted

Answered
Where is the error in my code?
Check the value of r: r = 0:0.07 It is a scalar wth value 0 because the colon operator ":" uses an increment of 1 by default. ...

4 years ago | 0

| accepted

Answered
How to display data on uitable from selected name in the listbox GUI MATLAB?
If the table should initially be empty, then in the OpeningFcn, initialize the Data of handles.uitable1 to be cell(0,7). (That i...

4 years ago | 0

| accepted

Answered
Import data from text file with lines of unequal length as fast as possible.
I don't know if it's "as fast as possible", but this may be faster than fgetl/str2num: fid = fopen('sample.txt'); A = {}; tic...

4 years ago | 1

| accepted

Answered
How to reformat this table's information so that a column of data becomes the header's for matching data?
Here's one way to do it: % construct the initial table: Items = ["Item1";"Item2";"Item3";"Item4";"Item5";"Item6";"Item7";"Item...

4 years ago | 1

| accepted

Answered
Does surf() Behave as Expected with ndgrid() Inputs?
"Why isn't Case 4 the same as Case 2?" Because Case 2 is erroneous. For vectors X and Y input to surf, matrix Z must be of size...

4 years ago | 2

| accepted

Load more