답변 있음
How to know the exact colour after a level of transparency being applied?
The color you see through a semitransparent element depends on the background. The rule is simple: alpha = rand; % ...

3년 초과 전 | 0

| 수락됨

답변 있음
Remove the 1x1 Cell Array from the Cell Array
If you want D{1} = [2, 1], use: D{1} = [2, 1] % or equivalently D = {[2, 1]} Expanded: D = {[2,1], [1,2,0]} D{1} D{2} Ma...

3년 초과 전 | 0

| 수락됨

답변 있음
code no good :(
areaOriginal = area(widthOriginal,thicknessOriginal); This creates a diagram and returns the handle to the graphics object. ar...

3년 초과 전 | 0

답변 있음
How to treat select elements from within multiple cells as a single vector
C = cell(5, 4); C(:) = {2:5}; % Faster than with DEAL V = cellfun(@(x) x(1,1), C(2:end,1), 'UniformOutput', 1) V = ...

3년 초과 전 | 0

| 수락됨

답변 있음
Error while running matlab script from Linux terminal
Is this a script or function? Obviously it is not included in the PATH. So either change the current path or add the folder to t...

3년 초과 전 | 0

| 수락됨

답변 있음
Add code to have switch repeat if a case is not met
knownLevels = {'easy', 'medium', 'hard'}; Levels = [10, 50, 100]; fprintf('\nChoose one of the known levels: %s\n', strjo...

3년 초과 전 | 0

답변 있음
When calling a user defined function, MATLAB throws an error for simple matrix multiplication
Use the debugger to examine the problem: dbstop if error Run your code again afterwards. If it stops at the error, check the d...

3년 초과 전 | 1

답변 있음
Is it possible to programmatically check whether MATLAB has been started with the "-sd" option?
PID = feature('getpid'); [status, out] = system(sprintf('ps -p %d -o args', PID)) Parsing the char vector out is not trival: E...

3년 초과 전 | 0

| 수락됨

답변 있음
Generating a combination matrix within a certain condition
After some test I could simplify the original combvec and including the limit is easy also: % Without limit, but considering th...

3년 초과 전 | 1

답변 있음
How can I apply filter with loop-based function instaed of using filter( ) : built in MATLAB function?
You can find a Matlab function for filtering here: https://www.mathworks.com/matlabcentral/answers/9900-use-filter-constants-to-...

3년 초과 전 | 0

답변 있음
Generating a combination matrix within a certain condition
It is easy to modify the code of a copy of Matlab's combvec function, which uses the class of the input: Change the zeros(., .) ...

3년 초과 전 | 1

답변 있음
How could I possibly iterate over three 3D arrays and use their variable names iteratively in the title and axes?
v_dx = struct('EField_h', EField_h(idx_phi,idx_theta,:), ... 'EField_v', EField_h(idx_phi,idx_theta,:), ... ...

3년 초과 전 | 0

| 수락됨

답변 있음
When I import google sheet into Matlab, I get the first line imported as the url for my google account sign in
If the file starts with <!doctype html><html lang="en-US" dir="ltr"><head> it is an HTML file, not a JSON file. Then jsondeco...

3년 초과 전 | 0

답변 있음
How to display a single element from a matrix?
Indexing is a fundamental Matlab method. To learn the basics asking in the forum is less efficient than using the tutorials: Ge...

3년 초과 전 | 0

답변 있음
How can I import multiple fig files into a single figure in a tiled layout?
Using a vector as 3rd input in subplot allows to span an axes over multiple blocks of the layout: FigH = figure; subplot(2, 3,...

3년 초과 전 | 0

답변 있음
When triying to oppen a .m file instead of the editor oppening, a command prompt appears
Open the section "Editor/Debugger" in Matlab's preferences and select "MATLAB editor" as editor.

3년 초과 전 | 1

| 수락됨

답변 있음
Artefacts when filtering a contiguous signal
The final state of the filter parameters after the 1st block is not the value of the signal. Replace: zi = vec1(end-2:end); % ...

3년 초과 전 | 1

| 수락됨

답변 있음
How can I calculate trapz value based on an event counter and then plot it?
As far as I understand your code was almost working. I added an if condition to skip scalar data and shifted the index for the o...

3년 초과 전 | 1

| 수락됨

답변 있음
Polyfit polynomial badly conditioned on Linux whereas on Mac no warnings
The warning is serious. Although the results look find in your case, scaling the input is the way to go for a scientifically sta...

3년 초과 전 | 1

| 수락됨

답변 있음
Turn code into function
Instert one line on top: function ANameOfYourchoice and save the file as "ANameOfYourchoice.m".

3년 초과 전 | 0

답변 있음
Running two very similar scripts, getting different resolution figures when exported.
It looks like one of the figures uses painters and the other one OpenGL as renderer. OpenGL is enabled automatically, if a more ...

3년 초과 전 | 1

| 수락됨

답변 있음
How to generate a specific number of values within a range ?
R = size(Q,1); First_second_ele = zeros(R,2); Y = zeros(R, 60); for k = 1:R tmp = nonzeros(qm(k,:)); %extraction f...

3년 초과 전 | 0

| 수락됨

답변 있음
What is wrong with for loop iteration that is put in a function?
function bool = composite(n) bool = false; % Create a default value if n > 2 for i = 2:n for j = 2:n ...

3년 초과 전 | 1

| 수락됨

답변 있음
How to define a function with multiple handle in a loop?
Is there a need to use an anonymous function? Why not writing a standard function? function y = pA(tau, s1, s2, s3) a=80/365...

3년 초과 전 | 0

| 수락됨

답변 있음
How can i achive this kind of plot?
Go to the FileExchange and search for "radar" or "spider" plots.

3년 초과 전 | 0

| 수락됨

답변 있음
Cell array and num2str comparison
The variable a is a cell array containing 2 scalar numbers, while b contains 2 CHAR vectors. a = {42, 12} c = {'42', '12'} Th...

3년 초과 전 | 1

| 수락됨

답변 있음
MATLAB PCode Warning on R2021a
This can happen only, if somebody has edited the file isprop.m . Modifying Matlab's built-in functions is not useful and this ca...

3년 초과 전 | 0

| 수락됨

답변 있음
Intersect() with with repetition
If you really need the redundant information in iAB_C, iAB_Cprime, idx1, idx2, this is faster than the original version tested w...

3년 초과 전 | 0

| 수락됨

답변 있음
How to quickly calculate the following function?
See also: https://fredrikj.net/blog/2022/02/computing-the-lerch-transcendent/ Calculating the sum seems to be more stable. F...

3년 초과 전 | 0

| 수락됨

답변 있음
Artifacts when converting .svg to pdf
The output is fine, if I open your SVG in Edge and print it to a PDF using doPDF (by the way: version 7, the modern versions are...

3년 초과 전 | 0

더 보기