Community Profile

photo

Fangjun Jiang


Last seen: Today
2,508 total contributions since 2011

What is a model?
Professional Interests: Model-Based Development

Contact

Fangjun Jiang's Badges

  • Revival Level 3
  • First Review
  • 24 Month Streak
  • Ace
  • Thankful Level 2
  • Knowledgeable Level 4
  • First Answer
  • Solver

View details...

Contributions in
View by

Answered
getting data from structure
temp=[S.speed]; out=temp(1:3:end) % or get all three speeds Speed=reshape([S.speed],3,[])

2 days ago | 0

Answered
using the data from struct
If you can't change the other program, Out=YourOtherProgram(), where "Out" is a data like "ans" in your picture, then you can u...

3 days ago | 0

| accepted

Answered
SIL using model reference
I thought the document was clear. To deploy the generated code as part of a larger application that uses the referenced model, ...

3 days ago | 0

Answered
A is a matrix of size 32*32.I want to subtract elements of each 4*4 block of A from their respective 4*4 means
A=rand(32); out = blockproc(A,[4 4],@(x)mean(x.data(:))); temp=repmat({ones(4,1)},8,1); temp=blkdiag(temp{:}); Result=A-te...

4 days ago | 0

Answered
How to prevent stateflow from opening the system?
Maybe, it is dependent on how you program it? The following example doesn't show the model until the last line. bdclose all; n...

5 days ago | 0

Answered
What kind of source block is this?
double click to open it. The title of the dialog window shall tell the block type.

7 days ago | 0

Answered
How to Model For loop as Simulink Model?
Use "For Iterator Subsystem"

9 days ago | 0

| accepted

Answered
str2num results
ss() happen to be a function. You could run b=ss alone;

12 days ago | 0

Answered
Why wont this run? "Array indices must be positive integers or logical values."
Most likely typo f = (1/(2*(pi)))*(L*C*(((R1^2)*C-L)/((R2^2)*C-L)))^(1/2)

12 days ago | 0

Answered
How do I define and use a standard range written by variable
N=10; % provide a reasonable number based on the range of input data n=1:N; LowBound=690*n; HighBound=1200*n; InputData=[...

12 days ago | 0

Answered
Simulink sample time error
The error has nothing to do with the script. According to the error message, your simulation step size is fixed, 1 second. Howev...

13 days ago | 0

Answered
Calculating that power supply won't burn my laptop
Modern power supplier/charger are all "smart" devices. The power/volt/max current numbers are not derived directly from the simp...

18 days ago | 0

Answered
Cannot get points on a plot to show
You are plotting one point at a time, use plot(N,error(N),'+') or at the end, plot(1:10,error)

18 days ago | 0

| accepted

Answered
Assign a number to a letter in excel
X1={'A','B','C'}'; y=cell2mat(X1)-64

18 days ago | 0

Answered
create menu with input
x=5; xx=string(1:x); menu('choose',xx(:))

19 days ago | 0

Answered
Help with restricting input
Suprisingly, just run your specification and it works in MATLAB number=input('Enter a whole number between 1 and 100:') while ...

19 days ago | 0

| accepted

Answered
Index Exceeds the number of array elements (993268)
If you have an array with 10 elements but you are trying to access the 11th element, you got this error. Just step through your ...

19 days ago | 0

| accepted

Answered
how can I compute distances:
Run the code and then run "license inuse". Only MATLAB is needed.

21 days ago | 0

Answered
connecting simulink with matlab
results=sim('mymodel')

21 days ago | 0

Answered
I want to generate a time vector
datetime([0,0,0,6,30,0]):minutes(5.12):datetime([0,0,0,15,0,0])

24 days ago | 0

Answered
How do I programmatically set the parameters of a Simulink-PS Converter?
Click one such block in your model and run "get(gcbh)" in Command Window to learn about its properties and values. You could do...

24 days ago | 1

| accepted

Answered
Drawing Rectangle/Lines with data
rectangle('Position',[0 0.15 0.012 0.012]) axis([0 0.02 0 0.2])

25 days ago | 0

| accepted

Answered
Mysterious "Operands to the || and && operators must be convertible to logical scalar values." error
this line if ~isempty(infMessage) && strmatch('optimlib:optimfcnchk',infMessage)

27 days ago | 0

Answered
How can I iteratively create blocks in simulink/simscape and populate them with variables?
What you need are functions like add_block(), add_line(), set_param() Follow examples in this section of the document "Programm...

1 month ago | 1

| accepted

Answered
How to check for common elements among multiple arrays ? Number of arrays are more than 100 and sizes vary for each array
Use a loop Com=intersect(out{1,1},out{1,2}); for k=3:size(out,2) Com=intersect(Com,out(1,k)); if isempty(Com) break; end ...

1 month ago | 0

| accepted

Answered
Compiled application does not write to diary log file
I think you are right. The cause is that there is no Command Window in your compiled app. I would suggest writing to a specific...

1 month ago | 0

| accepted

Answered
How to change the initial condition of a block in the model with Simulink.Parameter?
The initial condition can be regarded as a state. Use the "State Writer" block. Follow examples. https://www.mathworks.com/help...

1 month ago | 0

Answered
Error using str = input(prompt,'s')
YesNo = input(prompt2,'s')

1 month ago | 1

| accepted

Answered
How can I create logsout in base workspace after running sim(), without disabling fast restart?
When using sim(), the result need to be returned logsout=sim('TestLogsout2','ReturnWorkspaceOutputs', 'on')

1 month ago | 0

Load more