Answered
length of a string
str='abcdefe' size(str) length(str) numel(str)

15 years ago | 1

| accepted

Answered
Extract time series data from figure
Use this example: %% f=figure(1); h=plot(magic(4)); l=findobj(gca,'type','line'); x1=get(l(1),'xdata'...

15 years ago | 0

| accepted

Answered
simulink error
Why do you define your function as "simulink"? It sounds like you are using the Simulink toolbox if you are talking about S-func...

15 years ago | 0

Answered
conditional statement with ||
If A is false, then A && B will be short-circuited. No need to use the latter approach. Use the first one because it's easy to r...

15 years ago | 0

| accepted

Answered
Bad homework problems
I think the professor has a good intention and a good point. I would not want grade school math teacher to teach my kids to use ...

15 years ago | 1

Answered
Using global variables in Embedded Matlab function in simulink
Those are just warnings. If you are sure that you don't write to the memory as often as you read it, you can disable the warning...

15 years ago | 0

Answered
Store answers in multiple variables?
"hold on" is for graphics. It has nothing to do your operation. Depending on your cell array B, you may not need cell2mat. Se...

15 years ago | 0

| accepted

Answered
GUIDE callback question
The code is correct. The problem seems to be caused by operator error when modifying the GUI elements. Root cause is unknown. Se...

15 years ago | 0

| accepted

Answered
Command line interface to toggle "Logged signals as specified by model reference"
set_param(Block,'DefaultDataLogging','on')

15 years ago | 0

| accepted

Answered
Hi all, I want to find the value of a graph at a certain point of time in simulink.
The best way is to obtain the data of that graph and then use interp1() to find out the y value corresponding to the x value. Fo...

15 years ago | 0

| accepted

Answered
A two dimensional matrix with columns having different length
No. You can't. However, you can use cell array. C1=[1 2 3 4]'; C2=[1 2 3 4 5]'; C={C1,C2};

15 years ago | 2

| accepted

Answered
How can I create a table to organize S-function block mask parameters?
You can do most of those types of mask through user interface. Select a subsystem block, right click, select "mask subsystem ......

15 years ago | 0

Answered
What's the best approach for learning S-Function development
The S-function section of the Simulink document is sufficient for you to start writing S-function. I prefer S-function using MA...

15 years ago | 1

Answered
Search and Parse Variable Length Text Files to Arrays?
Copy your text to file test.txt and run the following code. Note that you may lose precision in NumData comparing to the digits ...

15 years ago | 0

| accepted

Answered
cell problem
size() returns 2 values. mean() is a MATLAB function so not to use it as a variable name. To assign a matrix to a cell array,...

15 years ago | 0

| accepted

Answered
Adressing
help sub2ind help ind2sub [row,col]=ind2sub(size(A),9) *I guess you mean this:* A=[1 2 3 ;7 5 3;9 8 3;11 53 45]; [R...

15 years ago | 0

| accepted

Answered
How to plot a vector using a variable that contains the name of the vector.
You will need to use plot(eval(x)). If inside a function, use plot(evalin('base',x)). Better way is to plan and re-organize you...

15 years ago | 1

| accepted

Answered
Problem when running a GUI to open, display and plot excel data from a *.xls file.
Apparently, you have two functions with the exact same name. function [x,y] = readExcelColumns(fileName,xColNum,yColNum)

15 years ago | 0

| accepted

Answered
how to find distance between two points?
Pos=[x1 x2;y1 y2] D=dist(Pos);

15 years ago | 3

Answered
Plotting a function over an interval
You mean this? x = 0:.01:2; y1= atan(exp(x).*(x-1))+ pi/2; plot(x,y1); help plot for details. plot(x1,y1,'r',x2...

15 years ago | 0

Answered
String Reading Functions
I don't think there is a readily available function right for it. To separate a word, it's pretty easy, especially when the numb...

15 years ago | 0

| accepted

Answered
Generating sequence
a=[ones(30,1);zeros(170,1)]

15 years ago | 0

| accepted

Answered
get handle of subplot?
handle=subplot(311); get(handle,'position')

15 years ago | 1

| accepted

Answered
Best method to clear persistent variables
When you use Vars=whos, it returns flag indicating global variable and persistent variable. You can use that to pick up persiste...

15 years ago | 1

| accepted

Answered
Making all the plots to start from the same point.
x=1:10; y1=1:10; y2=10:10:100; figure(1);plot(x,y1,'r',x,y2,'b'); figure(2);plot(x,y1,'r',x,y2-y2(1)+y1(1),'b');

15 years ago | 0

| accepted

Answered
separate lines on 2d graph using two separate pairs of vectors
line([x1,m1],[y1,n1]); hold on; line([x2,m2],[y2,n2]);

15 years ago | 0

Answered
How do I insert a caption below a figure in Matlab?
Use text() or annotation() function. Or maybe you mean xlabel()

15 years ago | 1

Answered
why is line function not working?
You probably specified it wrong. line([x1 x2],[y1 y2]), not line([x1,y1],[x2,y2]) line([0 1],[0 1]), not line([0 0],[1 1])

15 years ago | 1

| accepted

Answered
Intersection of multiple time-series
Use this example, the key is to check the extra return arguments of intersect(). %% A={'a',1;'b',2;'c',3;'d',4}; B={'...

15 years ago | 0

Answered
can we use numbers in variable names?
Yes, as long as it doesn't start with a number. See doc genvarname for more details. >> Var2=1; 2Var=3; ??? 2Var=3; ...

15 years ago | 0

| accepted

Load more