Respondida
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...

más de 5 años hace | 0

Respondida
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

más de 5 años hace | 0

Respondida
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...

más de 5 años hace | 0

| aceptada

Respondida
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...

más de 5 años hace | 2

| aceptada

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

más de 5 años hace | 0

| aceptada

Respondida
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...

más de 5 años hace | 0

| aceptada

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

más de 5 años hace | 0

Respondida
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)...

más de 5 años hace | 0

Respondida
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') ...

más de 5 años hace | 5

| aceptada

Respondida
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...

más de 5 años hace | 0

Respondida
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...

más de 5 años hace | 0

| aceptada

Respondida
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:...

más de 5 años hace | 2

Pregunta


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...

más de 5 años hace | 0 respuestas | 0

0

respuestas

Respondida
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...

más de 5 años hace | 0

Respondida
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 = ...

más de 5 años hace | 0

| aceptada

Respondida
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); ...

más de 5 años hace | 0

Respondida
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_...

más de 5 años hace | 1

| aceptada

Respondida
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 ...

más de 5 años hace | 0

| aceptada

Respondida
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...

más de 5 años hace | 0

Respondida
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...

más de 5 años hace | 0

| aceptada

Respondida
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

más de 5 años hace | 0

Respondida
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...

más de 5 años hace | 0

Respondida
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, ...

más de 5 años hace | 0

Respondida
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,:)

más de 5 años hace | 0

| aceptada

Respondida
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 ...

más de 5 años hace | 1

Respondida
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]'...

más de 5 años hace | 1

| aceptada

Respondida
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...

más de 5 años hace | 0

| aceptada

Respondida
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 ...

más de 5 años hace | 1

| aceptada

Pregunta


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 ...

más de 5 años hace | 1 respuesta | 0

1

respuesta

Respondida
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...

más de 5 años hace | 0

| aceptada

Cargar más