Answered
arrangment matrix in special way
D = zeros(20,20); for offset = (0:4)*4 idx = offset+(1:4); D(idx,idx) = A; D(mod(idx+4-1,20)+1,idx) = B; D(...

5 years ago | 0

Answered
Change the value into table in GUI
handles.beamradius is an Edit box in your GUI, but in the function plotthefibers_Callback, you have this line toward the end: h...

5 years ago | 0

Answered
how can I generate a grayscale image with the triangle having an intensity value of 22 and the background having an intensity value of 229.
A = imread('image.png'); % image.png is the image posted, which is a logical array A_out = zeros(size(A),'uint8'); % greyscale ...

5 years ago | 1

| accepted

Answered
3 images fused into RGB placed upon one another
A = imread('triangle.png'); B = logical(imread('circle.png')); % convert uint8 to logical to be consistent with A and C C = im...

5 years ago | 1

| accepted

Answered
How to remove or add portions of the x-axis that isn't being used
There are different ways to do it: xlim('tight'); % option 1 xlim([-4 5]); % option 2 set(gca(),'XLim',[-4 5]); % option 3 I...

5 years ago | 0

Answered
How to compare two non-equal columns from 2 tables and extract values corresponding to matching column entries?
Here's how I would do it if the datasets were matrices rather than tables: % find which elements of the first column of dataset...

5 years ago | 0

| accepted

Answered
Still need help on lab question
You have to define value1, value2, and numPointsInBetween yourself. They are, respectively: the minimum x the plot shows, the ma...

5 years ago | 0

| accepted

Answered
How to compare two vectors that don't have equal length?
Well, you can compare the first 755 elements: dx = x1 - x2(1:end-1); or you could compare the last 755 elements: dx = x1 - x2...

5 years ago | 1

| accepted

Answered
Deleting rows in a cell array based on a specific value in a column
Do this: A([A{:,2}] == 0, :) = []; The [A{:,2}] part horizontally concatenates all the contents of the cells in the second col...

5 years ago | 1

| accepted

Answered
heat map error y values must equal number of rows in colordata
The problem is that turbinePowerMean and turbinePowerStd are initialized to be 10-by-8 matrices here: turbinePowerMean = zeros(...

5 years ago | 0

| accepted

Answered
Choosing elements from a 2D array
int(int(:,1) >= 0 & int(:,1) <= 1,1)

5 years ago | 0

| accepted

Answered
When plotting heat maps matlab plots 80 different figures
The function windTurbineModel creates a figure; you call windTurbineModel 80 times. Therefore, 80 figures are created via windTu...

5 years ago | 0

Answered
hello I am getting this warning: Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in dev4 (line 121)
Indexing in MATLAB starts at 1, not 0. Your loops iterate starting with 0 and then try to use that as an index, hence the error...

5 years ago | 0

| accepted

Answered
How to specific fig handle in function savefig
The two- and three-input-argument options for calling savefig expect the figure to be the first input argument, so it would be: ...

5 years ago | 1

Answered
code running endlessly without stopping
These lines: while (Iu-IL)>e end define an endless loop, according to the values of the variables Iu, IL, and e you have defi...

5 years ago | 0

Answered
Making a new function with code
function poweroutput(Windspeeds,Cd,deltaT) %vairables defined Cp = 0.335; Ct = 0.042; Vrated = 11.5; %m/s Vcutin = 3; %...

5 years ago | 0

| accepted

Answered
Check empty & not empty of text box in GUI
replace empty with isempty

5 years ago | 0

| accepted

Answered
How to If certain number is in one column, record another number in another column
If the value in the second column is x, then the value of the fourth column should be 1-x. This is true because 1-0=1 and 1-1=0....

5 years ago | 1

| accepted

Answered
I want to add number in given sequention
Referring to the code you posted in a comment: v(2:3:end) = v(2:3:end)+0.05;

5 years ago | 0

| accepted

Answered
Why wont MATLAB let my plot using linspace?
link_forces contains just the last solution (i.e., for x == 1.38). increase is your variable that contains all link_forces, so ...

5 years ago | 0

| accepted

Answered
adding a for loop for a super simple code
If I understand correctly, it seems like you can say: if dist >= 100 % 100 meters, assuming your unit conversions are ok. conve...

5 years ago | 0

Answered
Index exceeds the number of array elements
In your if and elseif conditions you are comparing the vector pf with the scalar 1. You should use pf(j) instead of pf in those ...

5 years ago | 1

| accepted

Answered
How do I compute these finite sums with a for loop?
Here's one way to do 500 + 501^2 + 502 + 503^2 + ... + 1500: total = 0; for n = 500:1500 if mod(n,2) == 0 % n is even -> ...

5 years ago | 0

| accepted

Answered
Error message received when entering code
'dot' is both a function and a variable. Use clear dot to remove the variable dot. Then when you run dot(U1,U2), it'll calculat...

5 years ago | 0

| accepted

Answered
How to add trendline
Look into movmean.

5 years ago | 0

Answered
user creation plot in gui
Three main things to be aware of: 1) In MATLAB, using the colon operator to specify a vector: the syntax is "begin:jump:end" ra...

5 years ago | 2

| accepted

Answered
Write a function named custom_blocks
function out = custom_blocks(in) out = [in 2*in; 3*in 4*in]; end

5 years ago | 0

Answered
Hi guys, help me please, how can I aggregate one or more structures inside another one?
This will give you an array of structs, each with one field called 'firstfield' whose value is the corresponding element of HELP...

5 years ago | 0

| accepted

Answered
Index exceeds the number of Array elements by (2) is the error I am receiving at line number 34.
dxdt(i,1) is calculated from X(i+1); the first time through the loop, i is 2, so X(i+1) is X(3), which is erroneous because X ha...

5 years ago | 0

Load more