Answered
passing handle objects by value
You don't need to. classdef aclass < handle properties a end end l={} a = aclass(); a.a = 10; l{e...

4 years ago | 0

Answered
Why this simple for loop doesn't work?
Use a debugger to check why.

4 years ago | 0

Answered
Unkown error my code is running 5 out of 10times randomly. i'm not changing anything but still runs sometime and throws error sometimes in random order
Why do you use 'elseif' below? Change it to just 'else'? function angle = Phase(C,i,j) if real(C(i,j)) >= 0 angle...

4 years ago | 0

Answered
How can i use C++ DLL in Simulink?
Did you try to use 'addheader' of loadlibrary? The error seems to be related to header files. https://www.mathworks.com/help/ma...

4 years ago | 0

Answered
How do you draw such dynamic diagrams that change over time?
Try this: https://www.mathworks.com/matlabcentral/fileexchange/74003-barchartrace

4 years ago | 0

Answered
I get this error when i try to load RL agents. Please Help!
Inside pfcagent.mat, the variable saved is not called "saved_agent". It must be called something else. That is why the first li...

4 years ago | 0

| accepted

Answered
Problems with redirected stdin and stdout when using py to run python code
Did you try: system('python -c "import ztest; ztest.ztest()"')

4 years ago | 0

Answered
Calling Python function with multiple outputs in Simulink
Which version of matlab and python are you using? I tested 2021a, and calling py.testQ.test(x, y) returns a Python tuple. ret ...

4 years ago | 0

Answered
Convert Python code to matlab
One possible approach is to call python from matlab. Please refer this this. https://www.mathworks.com/matlabcentral/answers/58...

4 years ago | 0

Answered
Adding elements to array without repeating
This will work: result = [F.a F.b F.c]; result = unique(result);

4 years ago | 0

| accepted

Answered
How can I find a character in a string?
ismember is the function you are looking for.

4 years ago | 1

| accepted

Answered
[MATLAB Compiler] I want to run a Python package created on Linux on Windows. I get an error when specifying the path to the folder.
Did you try: filename = ['C:/test/file.csv']; Or filename = ['C:\\test\\file.csv']; '\t' has special meaning, and it might c...

4 years ago | 0

| accepted

Answered
indexing a loop to run through multiple files
Try this: %% input csv files file = dir('*.csv'); %read the files into matlab num_files = length(file); %record how many file...

4 years ago | 0

| accepted

Answered
Adding elements to array without repeating
Use ismember(233, F.a) before adding it to F.a.

4 years ago | 0

Answered
How to realize the variable number of input parameters
How about input two arrays of coordinates? x=[1,2,3,4], y=[5,6,7,8] for example? Your function takes input of two arrays. It doe...

4 years ago | 0

| accepted

Answered
Getting the wrong output value when running the code
It is a simple function here. This kind of error can be easily found using matlab debugger. Set a break point in the loop, and h...

4 years ago | 0

| accepted

Answered
Random sample and percentage
Try this? column_count = 100; % your columns row_count = 200; % your rows percentage_to_take = 0.2; % you take 20% of total ...

4 years ago | 0

Answered
MATLAB Fedora 34 installer gui issues
How about running a VM of debian and install matlab there?

4 years ago | 0

Answered
Extract equivalent RGB without transparency from PNG with alpha channel
For each color channel, try re = (1-alpha)*foreground + alpha*background. Since here background is white, so each channel, b...

4 years ago | 0

| accepted

Answered
How do I access previous answers to my question?
From this page, select 'My MATLAB Answers" drop down. Then select "My questions".

4 years ago | 0

| accepted

Answered
Matlab is very slow on macOS Big Sure
Open a terminal window from MacOS and type top This will tell you which process is taking most of the CPU time. Also what is ...

4 years ago | 0

Answered
Running python script in C S-function Simulink
Can you change your python code to write to a file? Then your matlab code can read from the file to get the output.

4 years ago | 0

Answered
How to create a bus communication with System Composer ?
Yes, it is doable. First create the bus from the source to the first destination. Then hold down the control key of your keyboa...

4 years ago | 1

Answered
Delete all rows from a cell array
arr = cell2mat(cellArray); % convert to array first arr(arr>7) = []; % remove cellArray = num2cell(arr); % convert back

4 years ago | 0

Answered
Create a matrix of element (points) connectivity
Can you just change m=3; n=3; for 9 ponts?

4 years ago | 0

Answered
How can i reshape a matrix to my preferred dimension and discard the excess element
What is the original matrix you want to reshape? Is it signal? If so, how about reshaped = signal(1:fl, :)

4 years ago | 0

Answered
how to caculate distance?
Can you figure out the coordinates of those three dots? If so that the distance is defined as d=sqrt((x1-x2)^2+(y1-y2)^2)). Here...

4 years ago | 1

Answered
How to find MATLAB function blocks??
Once you find the root of state flow using sfroot, you can use the find function as you used above. In addtion you can add a new...

4 years ago | 0

Answered
construct a complex number using real part and abs data
This is really a math question. When you have the real part and the absolute value, the imaginary part is not determined in gene...

4 years ago | 0

Load more