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

fast 7 Jahre vor | 0

Beantwortet
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

fast 7 Jahre vor | 0

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

fast 7 Jahre vor | 0

| akzeptiert

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

fast 7 Jahre vor | 2

| akzeptiert

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

fast 7 Jahre vor | 0

| akzeptiert

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

fast 7 Jahre vor | 0

| akzeptiert

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

fast 7 Jahre vor | 0

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

fast 7 Jahre vor | 0

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

fast 7 Jahre vor | 5

| akzeptiert

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

fast 7 Jahre vor | 0

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

fast 7 Jahre vor | 0

| akzeptiert

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

fast 7 Jahre vor | 2

Frage


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

fast 7 Jahre vor | 0 Antworten | 0

0

Antworten

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

etwa 7 Jahre vor | 0

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

etwa 7 Jahre vor | 0

| akzeptiert

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

etwa 7 Jahre vor | 0

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

etwa 7 Jahre vor | 1

| akzeptiert

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

etwa 7 Jahre vor | 0

| akzeptiert

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

etwa 7 Jahre vor | 0

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

etwa 7 Jahre vor | 0

| akzeptiert

Beantwortet
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

etwa 7 Jahre vor | 0

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

etwa 7 Jahre vor | 0

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

etwa 7 Jahre vor | 0

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

etwa 7 Jahre vor | 0

| akzeptiert

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

etwa 7 Jahre vor | 1

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

etwa 7 Jahre vor | 1

| akzeptiert

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

etwa 7 Jahre vor | 0

| akzeptiert

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

etwa 7 Jahre vor | 1

| akzeptiert

Frage


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

etwa 7 Jahre vor | 1 Antwort | 0

1

Antwort

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

etwa 7 Jahre vor | 0

| akzeptiert

Mehr laden