Answered

Convert Cell Array to Num array

Maybe this is what you are looking for <http://www.mathworks.fr/matlabcentral/answers/12007-table-in-gui-data-to-matrix-expandab...

Convert Cell Array to Num array

Maybe this is what you are looking for <http://www.mathworks.fr/matlabcentral/answers/12007-table-in-gui-data-to-matrix-expandab...

13 years ago | 0

Answered

How to code the colors in MATLAB?

<http://www.mathworks.com/help/techdoc/ref/colorspec.html Colorspec> Example: plot(1,1,'*','MarkerEdgeColor','r') or ...

How to code the colors in MATLAB?

<http://www.mathworks.com/help/techdoc/ref/colorspec.html Colorspec> Example: plot(1,1,'*','MarkerEdgeColor','r') or ...

13 years ago | 0

Answered

closing a specified figure (if exist)

close(findall(0,'type','figure','name','flashing'))

closing a specified figure (if exist)

close(findall(0,'type','figure','name','flashing'))

13 years ago | 3

Answered

Import data from text file and use it on simulink

%I don't have your data so I must create my own data x = 0:.1:1; y = [x; exp(x)]; fid = fopen('exp.txt', 'wt'); fp...

Import data from text file and use it on simulink

%I don't have your data so I must create my own data x = 0:.1:1; y = [x; exp(x)]; fid = fopen('exp.txt', 'wt'); fp...

13 years ago | 2

Answered

How do i load dice faces in the gui for my dice??

instead of loading dice faces you can just show the dots on a graph like this: v=randi(6); hold off switch v case 1...

How do i load dice faces in the gui for my dice??

instead of loading dice faces you can just show the dots on a graph like this: v=randi(6); hold off switch v case 1...

13 years ago | 0

Answered

how to start writing a program ?

# be familiar with MATLAB and read at least documentation Getting Started part # know what functions are and how to create them...

how to start writing a program ?

# be familiar with MATLAB and read at least documentation Getting Started part # know what functions are and how to create them...

13 years ago | 1

Answered

polar-style direction plot

doc quiver <http://www.mathworks.com/help/techdoc/ref/quiver.html quiver documentation> example %create fake data to plo...

polar-style direction plot

doc quiver <http://www.mathworks.com/help/techdoc/ref/quiver.html quiver documentation> example %create fake data to plo...

13 years ago | 0

| accepted

Answered

What is the difference between the statements: A=2; A=(2); A=[2]?

In MATLAB values like [2] and (2) are the same as 2, for the ( type they mean other things when used after a variable or functio...

What is the difference between the statements: A=2; A=(2); A=[2]?

In MATLAB values like [2] and (2) are the same as 2, for the ( type they mean other things when used after a variable or functio...

13 years ago | 0

Answered

Simulink Mask Parameter

For example one Subsystem called Subsystem on a model called untitled, SG is one mask variable, to change that variable do this:...

Simulink Mask Parameter

For example one Subsystem called Subsystem on a model called untitled, SG is one mask variable, to change that variable do this:...

13 years ago | 1

| accepted

Answered

pop up menu regarding

remove this: % Set current data to the selected data set. set(handles.popupmenu1,'value',1) ; and it should work just...

pop up menu regarding

remove this: % Set current data to the selected data set. set(handles.popupmenu1,'value',1) ; and it should work just...

13 years ago | 0

Answered

Struct to matrix

C1=1;C3=3;A2=2;C4=4; s={'C1' 'C3/A2' 'C4' } m=[cellfun(@eval,s)] %evaluate the calculations of the string If this assum...

Struct to matrix

C1=1;C3=3;A2=2;C4=4; s={'C1' 'C3/A2' 'C4' } m=[cellfun(@eval,s)] %evaluate the calculations of the string If this assum...

13 years ago | 0

Answered

Problem with my code, please help :) "In an assignment A(I) = B, the number of elements in B and I must be the same"

There are several mistakes in your code, for example: u(I+1)=u(I)-dt*((Cd*A*p)/(2*m))*u(I)*V(I); Doesn't work because dt is...

Problem with my code, please help :) "In an assignment A(I) = B, the number of elements in B and I must be the same"

There are several mistakes in your code, for example: u(I+1)=u(I)-dt*((Cd*A*p)/(2*m))*u(I)*V(I); Doesn't work because dt is...

13 years ago | 0

Answered

Removing certain Rows from a matrix

n=[m(1:size(m,1),[1 2]); m(1:size(m,1),[3 4])]; %two columns n=n(any(~ismember(n(:,[1 2]),[0 0]),2),:) %one column not...

Removing certain Rows from a matrix

n=[m(1:size(m,1),[1 2]); m(1:size(m,1),[3 4])]; %two columns n=n(any(~ismember(n(:,[1 2]),[0 0]),2),:) %one column not...

13 years ago | 0

Answered

Matlab code - probably a simple mistake

You are just looking for plot(kx,ky) not all those plots Also the calculations generate several zero values, that's why plot(kx...

Matlab code - probably a simple mistake

You are just looking for plot(kx,ky) not all those plots Also the calculations generate several zero values, that's why plot(kx...

13 years ago | 0

Answered

How to create a number of "Edit Text" feilds in a GUI, depending on the user input given in the GUI through an "Edit text" field itself?

function testui hp = uicontrol('Style', 'pushbutton', 'String', 'do it',... 'Position', [1 150 60 60], 'C...

How to create a number of "Edit Text" feilds in a GUI, depending on the user input given in the GUI through an "Edit text" field itself?

function testui hp = uicontrol('Style', 'pushbutton', 'String', 'do it',... 'Position', [1 150 60 60], 'C...

13 years ago | 0

Answered

Random Number Generator

RandStream.setDefaultStream(RandStream('mt19937ar','seed',sum(100*clock))); n=10; %number of ids randi([1 n])

Random Number Generator

RandStream.setDefaultStream(RandStream('mt19937ar','seed',sum(100*clock))); n=10; %number of ids randi([1 n])

13 years ago | 0

| accepted

Answered

troubles in viewing variables in the Editor

Only works for variables that exist on the current workspace, run your code first and it works for the variables listed on the w...

troubles in viewing variables in the Editor

Only works for variables that exist on the current workspace, run your code first and it works for the variables listed on the w...

13 years ago | 0

Answered

What are the dependencies for findpeaks.m

Yes you need the signal processing toolbox for the findpeaks that comes with it. You can do your own findpeaks function or get ...

What are the dependencies for findpeaks.m

Yes you need the signal processing toolbox for the findpeaks that comes with it. You can do your own findpeaks function or get ...

13 years ago | 0

| accepted

Answered

How to obtain data from editbox using a pushbutton?

words = get(handles.edit, 'String'); %edit is the name of the edit box if you are using GUIDE the names of the editboxes are ...

How to obtain data from editbox using a pushbutton?

words = get(handles.edit, 'String'); %edit is the name of the edit box if you are using GUIDE the names of the editboxes are ...

13 years ago | 0

| accepted

Answered

Create function to calculate leap year

Take a look at this <http://www.mathworks.com/matlabcentral/fileexchange/14172-isleap-function ISLEAP Function> , also look at J...

Create function to calculate leap year

Take a look at this <http://www.mathworks.com/matlabcentral/fileexchange/14172-isleap-function ISLEAP Function> , also look at J...

13 years ago | 0

Answered

Where do people learn "bad" programming habits (i.e., goto, global, and eval)

I used a lot the goto and label functions with casio graphic calculators when I was in high school, with MATLAB you don't need t...

Where do people learn "bad" programming habits (i.e., goto, global, and eval)

I used a lot the goto and label functions with casio graphic calculators when I was in high school, with MATLAB you don't need t...

13 years ago | 2

Answered

What does this error mean? Error ??? Index exceeds matrix dimensions.. Code included.

The error message tells all you need to know, you are requesting one index bigger than the maximum index of the matrix, I can't ...

What does this error mean? Error ??? Index exceeds matrix dimensions.. Code included.

The error message tells all you need to know, you are requesting one index bigger than the maximum index of the matrix, I can't ...

13 years ago | 1

Answered

how can jump and go another line in a m-file?

MATLAB doesn't allow silly GOTO type functions, make conditions and create functions, or the easy and dumb way: if a=b; ...

how can jump and go another line in a m-file?

MATLAB doesn't allow silly GOTO type functions, make conditions and create functions, or the easy and dumb way: if a=b; ...

13 years ago | 2

| accepted

Answered

select a row from a matrix and a vector simultanesouly

for r=1:100 %row to remove or whatever you want to do X=rand(100,5); Y=rand(100,1); %show the r row on the workspace X...

select a row from a matrix and a vector simultanesouly

for r=1:100 %row to remove or whatever you want to do X=rand(100,5); Y=rand(100,1); %show the r row on the workspace X...

13 years ago | 0

Answered

writing "if" command for a>f>c

There's no cprintf on MATLAB, use disp to show simple messages on the command line or fprintf for extra features. a=1; i...

writing "if" command for a>f>c

There's no cprintf on MATLAB, use disp to show simple messages on the command line or fprintf for extra features. a=1; i...

13 years ago | 1

| accepted

Answered

GUI: how to configure radio buttons to activate/grey out a set of checkboxes?

Using GUIDE # Put one Button Group on your GUI # Put two radiobutton inside the Button Group (that makes them mutually exclusiv...

GUI: how to configure radio buttons to activate/grey out a set of checkboxes?

Using GUIDE # Put one Button Group on your GUI # Put two radiobutton inside the Button Group (that makes them mutually exclusiv...

13 years ago | 2

| accepted

Answered

Bit Flip-Bit Negation

d=8; %decimal value p=2; %position of the bit to flip b=dec2bin(d); %convert to binary %b(p)=num2str(~str2num(b(p))); %f...

Bit Flip-Bit Negation

d=8; %decimal value p=2; %position of the bit to flip b=dec2bin(d); %convert to binary %b(p)=num2str(~str2num(b(p))); %f...

13 years ago | 1

Answered

How to plot outputs from an equation with user inputs?

Oleg already gave you all the clues you need T1=1;T2=10;NPoints=5; u=10;v=20;w=1; %some inputs to your formula t=linspace...

How to plot outputs from an equation with user inputs?

Oleg already gave you all the clues you need T1=1;T2=10;NPoints=5; u=10;v=20;w=1; %some inputs to your formula t=linspace...

13 years ago | 0

| accepted

Answered

How to generate and calculate with empty values of matrix-elements

T(i) = 'NaN'; is wrong, your arrays have numeric values but you are trying to put one string in the array, you can't mix nume...

How to generate and calculate with empty values of matrix-elements

T(i) = 'NaN'; is wrong, your arrays have numeric values but you are trying to put one string in the array, you can't mix nume...

13 years ago | 0

| accepted