답변 있음
Creating a function that outputs a polynomial
tip: When you create a new function on matlab (right click directory>new file > function), it looks something like this: functi...

7년 초과 전 | 0

답변 있음
Is there any function for calculating the size of a position vector in matlab?
use the norm() function. example: norm([1 2 3]) ans = 3.7417

7년 초과 전 | 0

답변 있음
How to create variable to use on more than one function in App Designer?
https://www.mathworks.com/help/matlab/creating_guis/share-data-across-callbacks-in-app-designer.html you can store values in th...

7년 초과 전 | 0

| 수락됨

답변 있음
how to cause a change in the colour of a push button every time it is pressed ?
function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved...

7년 초과 전 | 2

| 수락됨

답변 있음
Extract data from array at set intervals to new array
you can use indexing. y(1:23:end)

7년 초과 전 | 0

| 수락됨

답변 있음
How to create a random number that is a percent of each element in a vector
here's a small example: a = [100 200 300 400 500; 600 700 800 900 1000] bet = []; for i = 1:size(a,2) %for the number of colu...

7년 초과 전 | 0

| 수락됨

답변 있음
Matrix dimension must agree
you are not using rand correctly. from the documentation: "X = rand returns a single uniformly distributed random number in the...

7년 초과 전 | 0

답변 있음
How to joint together two matrix?
A =[4 4 4 4 ;3 3 3 3;2 2 2 2;1 1 1 1]; B = repmat(1:4,4,1); C = cell(1,numel(A)); for i = 1:numel(A) C{i} = [A(i) B(i)...

7년 초과 전 | 0

답변 있음
How does I bring the line plot in front of the bar?
Use uistack(); a = plot(x,y) %let a be the handle to plot 1 b= plot(x2,y2) %let b be the handle to plot 2 uistack(a,'top') ...

7년 초과 전 | 5

| 수락됨

답변 있음
Index in position 1 is invalid. Array indices must be positive integers or logical values.
this line may be the cause: bar(bi, pc(ctx(i), choices(j))); because for i = 1, ctx(1) = 0. you cant index pc...

7년 초과 전 | 0

답변 있음
Adjust size of vector/matrix
f you want to set the first 50 elements of B to be equal to A: B(1:50) = A; If you mean to delete excess elements in B until y...

7년 초과 전 | 0

| 수락됨

답변 있음
How can I handle visibility on/off for plot function?
For graphic objects, there is a 'Visible' Property that you can adjust. If you have a handle for your line object, for example:...

7년 초과 전 | 2

질문


Table elements not updating automatically-- bug or setting? (R2018a)
I have a variable window open that is a table displaying my x y data. Sometimes it updates as I change the x y values, but there...

7년 초과 전 | 답변 수: 0 | 0

0

답변

답변 있음
Need help creating a two separate matrices; one matrix is a 5x5 and has ones in columns 1, 3, and 5. The other matrix is also 5x5, but in the elements in the fifth column are equal to the row number that they are on.
if you're looking for hints, check out the functions: size() ones() zeros() and this documentation on array indexing: https...

7년 초과 전 | 0

답변 있음
plot in predesigned figure
You can assign a handle to the axes of the figure, and reference them in your plot function. for example: fig1 = figure; a = ...

7년 초과 전 | 0

| 수락됨

답변 있음
Matrix multiplication and addition
m1 = a(:,6); m2 = b(1:4,:)'; prod = m1.*m2; part_sums = sum(prod); r = part_sums(1); s = part_sums(2); ...

7년 초과 전 | 0

답변 있음
How to get consistent subplot widths with legend outside?
You can assign a handle to the legends and set all their xpositions to be the same. Do the same for the subplots. ex: %some_x_...

7년 초과 전 | 1

| 수락됨

답변 있음
graph multiple fields in a struct
fld = fieldnames(variable); %list of all field names.. data1, data2,data3... for i = 1:numel(fld) % for each field name ...

7년 초과 전 | 0

| 수락됨

답변 있음
Can I create points on polygon with specific distance between them?
depends if your y values are equally spaced in the first place. Is this an appropriate workaround?: % add this to your plot h...

7년 초과 전 | 0

답변 있음
How do I make a code that store large amount of information from excel into a matrix?
Are you trying to do this: m = numData1(:,[1:12]); this should give you a matrix with the first row corresponding to the eleme...

7년 초과 전 | 0

| 수락됨

답변 있음
I have a matrix (57,3600,45), how can I create matrices with (3600,45)?
does this give you what you want? test_num = 1; M(test_num,:,:) %where M= your matrix

7년 초과 전 | 0

답변 있음
greater than less than
here's an example: voltsadd_val = [1 5 3; -2 -5 5; 1 -5 3]; voltsadd_val(voltsadd_val>0) = 1; % if pos, 1 voltsadd_val(voltsa...

7년 초과 전 | 0

답변 있음
I'm trying to create a shopping list using buttons and am having trouble getting my list to stack items
some suggestions: function oatmeal_fn(Oatmeal_h, evt, TOTAL) % i would remove TOTAL if you could, ...

7년 초과 전 | 0

답변 있음
How to Rearrange a Matrix
% let M be your matrix of two columns ind = [2 4 6 7 8 12]; % desired indices new_M = M(ind,:)

7년 초과 전 | 0

| 수락됨

답변 있음
How can I generate an array of binary data of this form?
N = 18; M = zeros(N); %preallocate space for i =1: size(M,1) ind = randperm(N); % generates random indices between 1:N ...

7년 초과 전 | 1

답변 있음
Computing the median of a group except one member
Hello! Is this sort of what you're looking for? M=[1 2 3 6 5 4 2 3 4 1 5 6; 1 1 1 1 1 1 2 2 2 2 2 2; 2 4 6 5 7 8 3 7 5 7 5 3]'...

7년 초과 전 | 1

| 수락됨

답변 있음
Trouble displaying the final count
just do this: search = 'CAT'; locate = regexp(DNA,search) count = numel(locate{1}) %number of times CAT appears edit: it s...

7년 초과 전 | 0

| 수락됨

답변 있음
How can I make a push button in a uitable?
There is a callback property for the uitable called 'CellSelectionCallback' which will trigger a function each time you select ...

7년 초과 전 | 1

| 수락됨

질문


Using cellfun() to set cell array of graphic objects 'Visible' Property to 'off'
I have a 1xn cell array of graphic objects-- currently I have the logic in a for-loop for j = 1:numel(uis) uis{j}.Visible ...

7년 초과 전 | 답변 수: 1 | 0

1

답변

답변 있음
How to half the value of a constant inside an iteration?
maxiter = 100; iter = 1; x = 1:1:99; n = 8*(1/2).^x; % n = 8 , 4, 2, 0.5,... while iter< maxiter gamma = 10 * 10^(-n(it...

7년 초과 전 | 0

| 수락됨

더 보기