Answered
How to plot three different colored groups of log plots (5 lines, 5 lines, 2 lines) on the same axes?
You should provied the same number of legends. Something like, legend ('show','0-3m (1)','0-3m (2)','0-3m (3)','0-3m (4)','...

8 years ago | 0

Answered
i want to code such that the loop is constraint for two different values?
N = 108300; x = rand(N,1); sum_rows = 300; l1 = x(1:sum_rows:N); %take every 300th value l1_r = reshape(repmat(l1...

8 years ago | 0

| accepted

Solved


Remove NaN ?
input -> matrix (n*m) with at least one element equal to NaN; output -> matrix(p*m), the same matrix where we deleted the enti...

8 years ago

Solved


Back to basics 21 - Matrix replicating
Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix, generate an output matrix that consists o...

8 years ago

Solved


Reverse the elements of an array
Reverse the order of elements in an array: eg: input X = [ 1 2 3 ; 4 5 6 ; 7 8 9 ] o...

8 years ago

Answered
How can I end a for loop when a specific value is reached and create a new array with data that meets that condition?
If I understand correctly, you want to compare |meanr2| with the mean calculated from |ruber| but you're actually comparing it w...

8 years ago | 0

Answered
How to use two different color schemes in one bar chart?
figure wi=1; ax1 = subplot(2,1,1); bar(Y, wi); colormap(ax1,cool) legend('One','Two', 'Three'); ax2 = s...

8 years ago | 0

| accepted

Answered
How to make a break on the x axis?
plot(rand(150,1)) xticks([0 100 120 150])

8 years ago | 0

Answered
format the x-axis in a boxplot
set(gca,'FontAngle', 'italic') %for italics set(gca,'XTickLabel',{'$$a3_{1}$$','$$a3_{2}$$'}); %for...

8 years ago | 0

Answered
How do I run a matlab script automatically from an excel input?
There's nothing you can do inside Matlab to do this. Anyway, you should do it with a batch file and hyperlink that file on your ...

8 years ago | 0

Answered
When I am plotting figure in matlab with many legend entries, the legend box is covering my plot area and making some plots invisible.I tried using 'Orientation','Horizontal',but it spreads out to a larger row.Can anyone help me to resolve issue?
legend('Location','northoutside','Orientation','horizontal') I guess you might also want to fold it into two lines as shown...

8 years ago | 0

| accepted

Answered
How can find a same values in another matrix and copy the row
ind = arrayfun(@(y) find(B(:,1)==y),A(:,1)) CC = [A B(ind,:)]

8 years ago | 1

| accepted

Answered
How to look for minimum value in a vector from backwards?
find(A==A_min,1,'last')

8 years ago | 0

Answered
How can I insert an image when publishing a document?
% <<yourFile.jpg>> Make sure to save your image in the folder where your m-file is being published. More <https://de.mathwo...

8 years ago | 0

Answered
How to get variables needed for Simulink model?
filename = 'yourMatfile.mat'; yourVariables = {'X','caption'}; S = load(filename,yourVariables{:})

8 years ago | 0

Answered
how to update filename in a call to an external application ?
Hi Hans Jørgen Jensen , I've tried your code and yeah, I see your problem. I don't understand it but probably you could simpl...

8 years ago | 0

| accepted

Answered
How Can I add a data to a Stateflow as an input data?
check this <https://de.mathworks.com/help/simulink/slref/fromworkspace.html>

8 years ago | 0

Answered
Average timestamp 20 seconds interval data into hourly
dt = datetime('01.01.2015 00:00:00'):seconds(20):datetime('01.01.2015 05:00:00'); val = rand(901,1); TT = timetable(dt',...

8 years ago | 0

Answered
How do i Filter out table columns headers based on given query words?
x = rand(3,3); rowX = {'A1','A2','A3'}; xT = array2table(x,'RowNames',rowX) xA1 = table2cell(xT({'A1'},:))

8 years ago | 0

Answered
How do calculate the summation of every row in the given table?
yourTable.Sum = sum(yourTable{:,2:end},2);

8 years ago | 4

| accepted

Answered
how to naming files sequently?
prefix = 'TOTL_REDC_2017_07_'; days = {'02_','03_'}; hours = {'0500','0600'}; fileNames = cellfun(@(d,h) [prefix d h]...

8 years ago | 0

Answered
30-day running mean from hourly data
dt = datetime([Yrly_slr(:,1:4) zeros(length(Yrly_slr),2)]); TT = timetable(dt,Yrly_slr(:,5)); TT2 = retime(TT,'monthly',...

8 years ago | 1

| accepted

Answered
while condition to test numeric
t = 1; while t powerInput = input('Please enter the power input, number only and between 35kW and 45kW: '); i...

8 years ago | 0

Answered
Extracting elements from a matrix based on the maximum position in another matrix
arrayfun(@(j,f) A(j,f), J,1:size(A,2))

8 years ago | 0

| accepted

Answered
How small a number has to be to be "equal" to zero?
realmin

8 years ago | 0

Answered
how to open datafiles with an exe-file
!your_program.exe your_file

8 years ago | 0

| accepted

Solved


Select every other element of a vector
Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...

8 years ago

Answered
Stacking plots using subplot
figure subplot(3,1,1) %subplot(rows,coloumns,current_axis) subplot(3,1,2) subplot(3,1,3)

8 years ago | 0

| accepted

Solved


Swap the first and last columns
Flip the outermost columns of matrix A, so that the first column becomes the last and the last column becomes the first. All oth...

8 years ago

Load more