Answered

How to Convert Matlab for-loop in Python

Your code looks like mixture of matlab and python already. math.sin is python, not matlab. Try this: import math # Not sure yo...

How to Convert Matlab for-loop in Python

Your code looks like mixture of matlab and python already. math.sin is python, not matlab. Try this: import math # Not sure yo...

9 days ago | 0

Answered

error in calling python function from matlab

I am confused here. This doesn't look like valid python3 statements. import /home/pi/Desktop/plus; plus.add(150, 110) Do you ...

error in calling python function from matlab

I am confused here. This doesn't look like valid python3 statements. import /home/pi/Desktop/plus; plus.add(150, 110) Do you ...

9 days ago | 0

Answered

Real-time communication between python and Simulink.

Interesting. It is an old question but users are still interested in this. How about this approach? Go through a server. On the...

Real-time communication between python and Simulink.

Interesting. It is an old question but users are still interested in this. How about this approach? Go through a server. On the...

9 days ago | 0

Answered

euler's method

What is siny? Is it sin(y)? Also you dy is a constant in the loop, only depends on y(2) and y(1). Maybe it should depend on y(i...

euler's method

What is siny? Is it sin(y)? Also you dy is a constant in the loop, only depends on y(2) and y(1). Maybe it should depend on y(i...

9 days ago | 0

| accepted

Answered

Driving data from GUI application to the matlab script

Why don't you create your matlab script as a function and then take y as an input argument? function foo(y): % whatever yo...

Driving data from GUI application to the matlab script

Why don't you create your matlab script as a function and then take y as an input argument? function foo(y): % whatever yo...

10 days ago | 0

Answered

How to code to form such type of figure? what is the name of such type of graph?

It is called circular plot. matlab polarplot can do similar thing: x = linspace(0, 100) y = x plot(x, y) % a normal plot pol...

How to code to form such type of figure? what is the name of such type of graph?

It is called circular plot. matlab polarplot can do similar thing: x = linspace(0, 100) y = x plot(x, y) % a normal plot pol...

11 days ago | 0

Answered

Too many output arguments while launching workers with parfeval

According to the help of parfeval, the second input argument is NUMOUT. You gave 2?

Too many output arguments while launching workers with parfeval

According to the help of parfeval, the second input argument is NUMOUT. You gave 2?

11 days ago | 1

| accepted

Answered

fprintf for cell array data

Try to convert your cell data into char first. char(the_cell_you_want_to_print)

fprintf for cell array data

Try to convert your cell data into char first. char(the_cell_you_want_to_print)

11 days ago | 0

| accepted

Answered

Why do I get license manager error - 39?

Seems like your license doesn't include Simulink support? Simulink is an extra component on top of matlab.

Why do I get license manager error - 39?

Seems like your license doesn't include Simulink support? Simulink is an extra component on top of matlab.

11 days ago | 0

Answered

How to display an image within the figure in App Designer?

Try this in your callback: [file, path] = uigetfile({'*.png'; '*.jpg'}, 'Select file'); app.Image.Imag...

How to display an image within the figure in App Designer?

Try this in your callback: [file, path] = uigetfile({'*.png'; '*.jpg'}, 'Select file'); app.Image.Imag...

11 days ago | 0

| accepted

Answered

How do i install MATLAB in 20.04

It might have trouble to popup window for input information. Try the silent mode?

How do i install MATLAB in 20.04

It might have trouble to popup window for input information. Try the silent mode?

12 days ago | 0

Answered

Using a string in an if statement to print data from excel.

yes is a string if strcmpi(view_data, 'yes')

Using a string in an if statement to print data from excel.

yes is a string if strcmpi(view_data, 'yes')

12 days ago | 2

| accepted

Answered

find local minima within a time window of interest

You first need to figure out idx range of X for 250-350. Called them idx_start and idx_end. Then just min(Y(idx_start:idx_end)...

find local minima within a time window of interest

You first need to figure out idx range of X for 250-350. Called them idx_start and idx_end. Then just min(Y(idx_start:idx_end)...

17 days ago | 0

Answered

Convert to binary and save to database

Are you talking about image formats here? For binary, do you mean bitmap?

Convert to binary and save to database

Are you talking about image formats here? For binary, do you mean bitmap?

19 days ago | 0

| accepted

Answered

For/if loop for adding up only odd numbers

You mean this? for n = 1:100 if mod(n,2) == 1 c = (1/(n^2)); sum(c); end end Refer to this for how to compute...

For/if loop for adding up only odd numbers

You mean this? for n = 1:100 if mod(n,2) == 1 c = (1/(n^2)); sum(c); end end Refer to this for how to compute...

20 days ago | 0

Answered

Import MATLAB package located in different directory

I think it is similar to this answer. Basically you need to set the env var PYTHONPATH to include the location of that python pa...

Import MATLAB package located in different directory

I think it is similar to this answer. Basically you need to set the env var PYTHONPATH to include the location of that python pa...

20 days ago | 0

Answered

How to read the .out file

readmatrix can handle it. m = readmatrix('your_file')

How to read the .out file

readmatrix can handle it. m = readmatrix('your_file')

20 days ago | 0

Answered

How to read only numerical values of serial output data in MATLAB?

Your data file looks like a configuration file with key/value pair separated by ':'. One way to parse the data is to do this for...

How to read only numerical values of serial output data in MATLAB?

Your data file looks like a configuration file with key/value pair separated by ':'. One way to parse the data is to do this for...

23 days ago | 0

Answered

Draw surface of a football (American)

Hint: your assignment states z should be -Pi/2 < z < Pi/2. But your r range is (-1, 1), which corresponds to z range 0<z< Pi I...

Draw surface of a football (American)

Hint: your assignment states z should be -Pi/2 < z < Pi/2. But your r range is (-1, 1), which corresponds to z range 0<z< Pi I...

24 days ago | 1

Answered

How to call python script contains "pytorch" module normally

Append the path to torch to an env var called PYTHONPATH. Do this from matlab command line window: setenv('PYTHONPATH', [getenv...

How to call python script contains "pytorch" module normally

Append the path to torch to an env var called PYTHONPATH. Do this from matlab command line window: setenv('PYTHONPATH', [getenv...

24 days ago | 0

| accepted

Answered

What Mistake I am making in the code

Maybe this: sortbyrandomswaps([5 4 3 2 1]); function out = sortbyrandomswaps(n) while ~ all(diff(n)>=0) idx1 = ran...

What Mistake I am making in the code

Maybe this: sortbyrandomswaps([5 4 3 2 1]); function out = sortbyrandomswaps(n) while ~ all(diff(n)>=0) idx1 = ran...

24 days ago | 0

| accepted

Answered

Using cellfun to extract numbers from strings in a cell array

How about this: Cel = {'1-2-3-4-5-6' '5-6-7-8' [] []} ; xx = cellfun(@(x) foo(x), Cel, 'Un', 0); function ret = foo(x...

Using cellfun to extract numbers from strings in a cell array

How about this: Cel = {'1-2-3-4-5-6' '5-6-7-8' [] []} ; xx = cellfun(@(x) foo(x), Cel, 'Un', 0); function ret = foo(x...

24 days ago | 0

| accepted

Answered

not a binary MAT-file

Use matfile to read the file? On linux, try this from a terminal hexdump -c your_matfile.mat | more 3. On Windows, try this f...

not a binary MAT-file

Use matfile to read the file? On linux, try this from a terminal hexdump -c your_matfile.mat | more 3. On Windows, try this f...

25 days ago | 0

Answered

Not enough input arguments

Maybe you need to pass PHI and VARIOUS into you equ function as well?

Not enough input arguments

Maybe you need to pass PHI and VARIOUS into you equ function as well?

25 days ago | 0

| accepted

Answered

How to plot a Structure with Time?

Add a title to your plot title(VarName.signals.title)

How to plot a Structure with Time?

Add a title to your plot title(VarName.signals.title)

25 days ago | 0

Answered

How to convert time in milliseconds to hour, minutes format?

What is time_seconds you passed to seconds? It needs to be a double. s = seconds(1000); s.Format = 'hh:mm'

How to convert time in milliseconds to hour, minutes format?

What is time_seconds you passed to seconds? It needs to be a double. s = seconds(1000); s.Format = 'hh:mm'

25 days ago | 0

Answered

Im not sure as to why this code wont stop running. Can some one help

Print out abs_error as well after you print est. Most likely abs_error is always larger than 0.000001.

Im not sure as to why this code wont stop running. Can some one help

Print out abs_error as well after you print est. Most likely abs_error is always larger than 0.000001.

25 days ago | 0

Answered

Problem with the evaluation of the product of triple integral

y is an array. You can't use it directly in integral3. Do the product yourself as a for loop. t = 15; sigma = 0.25; y...

Problem with the evaluation of the product of triple integral

y is an array. You can't use it directly in integral3. Do the product yourself as a for loop. t = 15; sigma = 0.25; y...

25 days ago | 1

| accepted

Answered

How can I force MATLAB to arrange inputs into a matrix of specified dimensions?

Why do you need to know the size of B? Maybe you want disp(str2double(B))

How can I force MATLAB to arrange inputs into a matrix of specified dimensions?

Why do you need to know the size of B? Maybe you want disp(str2double(B))

25 days ago | 0

| accepted

Answered

Plotting Solutions to the Heat Equation Through a Truncated Series Evaluation

The error seems to be caused by this line: quadgk(h_FC_integrand,x,0,5)); quadgk computes numerical integration. What do you e...

Plotting Solutions to the Heat Equation Through a Truncated Series Evaluation

The error seems to be caused by this line: quadgk(h_FC_integrand,x,0,5)); quadgk computes numerical integration. What do you e...

25 days ago | 0