Answered
Skipping even indices in a for-loop and subsequently avoiding the odd values to appear in the output
When you assign a value to A(3,3)=1, Matlab will create a Matrix of the size 3,3 and will fill empty fields with 0. A(3,3)=1 ...

alrededor de 1 año ago | 0

| accepted

Answered
delete variable file name
Try this: delete(sprintf('%s.sim',newname))

alrededor de 1 año ago | 1

| accepted

Answered
I am trying to add two numbers in App designer code view and i am getting following error message
You need to access the value stored in your edit fields: a = app.EditField.Value; b = app.EditField2.V...

alrededor de 1 año ago | 0

| accepted

Answered
hObject error in execution of a checkbox
Your checkbox function does not know 'hObject': function checkbox() handles.fig=figure; handles.cbh = zeros(40,1); handl...

alrededor de 1 año ago | 1

| accepted

Answered
How to write repeating string with variables in for loop
Check if this works for you. for i=1:75 line1 = ' new ScreenItem(ScreenVideoComponent,'; line2 = sprintf(' Video...

más de 1 año ago | 1

| accepted

Answered
Having some problems with recursive function
This strange behaviour originates in a unfortunate function name. function S = mySum(A) S = myplus(A, length(A)) function ...

más de 1 año ago | 0

| accepted

Solved


Sum all integers from 1 to 2^n
Given the number x, y must be the summation of all integers from 1 to 2^x. For instance if x=2 then y must be 1+2+3+4=10.

más de 1 año ago

Solved


Magic is simple (for beginners)
Determine for a magic square of order n, the magic sum m. For example m=15 for a magic square of order 3.

más de 1 año ago

Solved


Make a random, non-repeating vector.
This is a basic MATLAB operation. It is for instructional purposes. --- If you want to get a random permutation of integer...

más de 1 año ago

Solved


Roll the Dice!
*Description* Return two random integers between 1 and 6, inclusive, to simulate rolling 2 dice. *Example* [x1,x2] =...

más de 1 año ago

Solved


Number of 1s in a binary string
Find the number of 1s in the given binary string. Example. If the input string is '1100101', the output is 4. If the input stri...

más de 1 año ago

Solved


Return the first and last character of a string
Return the first and last character of a string, concatenated together. If there is only one character in the string, the functi...

más de 1 año ago

Solved


Getting the indices from a vector
This is a basic MATLAB operation. It is for instructional purposes. --- You may already know how to <http://www.mathworks....

más de 1 año ago

Solved


Check if number exists in vector
Return 1 if number _a_ exists in vector _b_ otherwise return 0. a = 3; b = [1,2,4]; Returns 0. a = 3; b = [1,...

más de 1 año ago

Solved


Swap the input arguments
Write a two-input, two-output function that swaps its two input arguments. For example: [q,r] = swap(5,10) returns q = ...

más de 1 año ago

Solved


Reverse the vector
Reverse the vector elements. Example: Input x = [1,2,3,4,5,6,7,8,9] Output y = [9,8,7,6,5,4,3,2,1]

más de 1 año ago

Solved


Length of the hypotenuse
Given short sides of lengths a and b, calculate the length c of the hypotenuse of the right-angled triangle. <<http://upload....

más de 1 año ago

Solved


Generate a vector like 1,2,2,3,3,3,4,4,4,4
Generate a vector like 1,2,2,3,3,3,4,4,4,4 So if n = 3, then return [1 2 2 3 3 3] And if n = 5, then return [1 2 2...

más de 1 año ago

Solved


Return area of square
Side of square=input=a Area=output=b

más de 1 año ago

Answered
Accessing the Value of Variables in the Workspace
You can load your data into a structure: s=load('MyData.mat'); Now you can use fieldnames to obtain all variable names in yo...

más de 1 año ago | 1

| accepted

Answered
Undefined variable in app designer when the variable called in external function
Your external function does not know which variables you use in your app. You need to pass them along. Try changing else pr...

más de 1 año ago | 0

| accepted

Answered
Vector loop over multiple object handles inside a set function
You can use logical indexing. I wrote this earlier today for another question, but it is quite close to what you want to do: ...

más de 1 año ago | 0

Answered
how to click push button one by one without visible the button?
You can use the enable property of a pushbutton. for i=3:-1:1 h.pb(i)=uicontrol('style','pushbutton','position',[50 50+(...

más de 1 año ago | 0

Answered
how to run function for several times with different variables
In your example you do not need more than one variable: a=[5 8 9 11]; for i=1:numel(a) n=a(i)*0.1:a(i)*0.1:a(i); for...

más de 1 año ago | 0

Answered
Correct evaluation of a logical statement, incorrect result?
It would be helpful to see your code, to find any errors. This should work fine: A=rand(96,6); D=5; B=zeros(96,6); C=3*one...

más de 1 año ago | 1

| accepted

Answered
Reshaping an 1x365 matrix with daily observations within a year
You could add some zeros/NaNs at the end of your 365 datapoints, then you should be able to reshape: A=randi(100,365,1); A(e...

más de 1 año ago | 0

Answered
script for looping function
You just need to get rid of the (t,f1,f2) before the '=' when defining your function. You need to take a look at your loop aswel...

más de 1 año ago | 0

Answered
GUI handle structure not updating
You can use drawnow to update your graphic elements: function figure1_WindowKeyPressFcn(hObject, eventdata, handles) key = get...

más de 1 año ago | 0

| accepted

Answered
How to write a code for an iteration?
f=zeros(100,4); f(1,:)=[1 5 10 15]; for i=2:100 f(i,:)=[f(i-1,1)+f(i-1,2),f(i-1,3)+f(i-1,4),f(i-1,1)-f(i-1,2),f(i-1,3)-f(...

más de 1 año ago | 0

| accepted

Answered
Please help me fix the count for the nested for-loop
Your addHexNumber function actually does not work correctly. I think you need to change if bothSum > 16 to if bothSum > ...

más de 1 año ago | 1

Load more