Risposto
How can I plot a string function?
Is this the "string function" ? StrFunc = 'x.^2+2*b+c'; %Converting to a function handle Letters = unique(regexp(St...

oltre 7 anni fa | 0

Risposto
Maximizing code interpretability while minimizing computational cost.
The debate of code readability vs performance has been going on for a long time. Your #5 is probably the best choice : document ...

oltre 7 anni fa | 1

| accettato

Risposto
Recursive function not stopping
Is this what you want to do? % % x = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; ...

oltre 7 anni fa | 0

Risposto
How to call a function inside a parfor?
1. |phi| does not know what yraw and Vinv are. To fix, do this: function [obj grad] = phi(y, yraw, Vinv) %Pass yraw and Vi...

oltre 7 anni fa | 1

| accettato

Risposto
Suggestions for a laptop?
# Search for "best laptop for programming" or "best portable laptop" on the search engine. # Make sure computer meets Matlab mi...

oltre 7 anni fa | 1

Risposto
Calculate mean of certain row
Data = randi(10, 9, 2); %Your 9x2 matrix Means = zeros(3, 2); %Your output for j = 1:3 Means(j, :) = mean(Data...

oltre 7 anni fa | 0

| accettato

Risposto
Problem with "roots" command
Root = roots(...) %Not saving output correctly here This will override the value of Root every iteration, resulting in a 3x...

oltre 7 anni fa | 1

| accettato

Risposto
Can i make a personalized license warning message?
You could place a startup.m file in the matlab |path| or the |userpath| (ex: 'C:\Users\usr121\Documents\MATLAB\startup.m'). The ...

oltre 7 anni fa | 1

Risposto
Adding a random value (-0.1 : 0.1) to scatterplot data points to prevent exact overlapping.
Try this example to see how to adjust X and Y values by a random value between -0.1 to 0.1 only if (x,y) are duplicates. X...

oltre 7 anni fa | 1

Risposto
Explain how re-calling several user-defined-functions work much faster than the first call? And how should I ensure this happening everytime?
This might work. Use |memoize| to store a cache of the function call results. The first summon is slow, the 2nd summon is faster...

oltre 7 anni fa | 0

Risposto
Cannot get textscan() while loop to work
FID = fopen('X-MinutalXX.csv'); Data = textscan(FID, '%s%{MM/dd/yyy HH:mm:ss.SSS}D%f%f%f', 'Delimiter', ';', 'Headerlines',...

oltre 7 anni fa | 0

Risposto
Plot only for positive y
NEW ANSWER ylim([0 inf]) %Will automatically compute the limit where "inf" is used OLD ANSWER ylim([0, max([y(:); ...

oltre 7 anni fa | 0

| accettato

Risposto
Function 'subsindex' is not defined for values of class 'datetime'.
FID = fopen('test.csv'); Data = textscan(FID, '%D%f', 'Delimiter', ',', 'Headerlines', 1); fclose(FID); Data{1}.Yea...

oltre 7 anni fa | 0

Risposto
how to make a variable execute only once ?
Or you could make a class of type handle that stores the value of t. Every time you summon the method |getStr|, it'll return the...

oltre 7 anni fa | 0

Risposto
How can I simplify/vectorize this nested loop version of pascals triangle?
Behold, a function called |pascal| <https://www.mathworks.com/help/matlab/ref/pascal.html> S = pascal(n)

oltre 7 anni fa | 0

| accettato

Risposto
Can a parfor loop be restarted?
Perhaps you can save the input variables used for your |runfunction| into a separate cell array. Try this for example: Erro...

oltre 7 anni fa | 0

Risposto
How to use parfor
Are you trying to flip the matrix along the 2nd dimension? original = flip(original, 2) Can't do parfor in your case bec...

oltre 7 anni fa | 1

Risposto
mex script and how to show output from another function which is using vprintf()
Instead of using |vprintf|, try using |mexPrintf| <https://www.mathworks.com/help/matlab/apiref/mexprintf.html>

oltre 7 anni fa | 2

| accettato

Risposto
msgbox does not show title
Your "Results" text isn't showing because the window is too small. Try making it wider as such: angle = 30; true_vector_...

oltre 7 anni fa | 2

| accettato

Risposto
Viewing multi level structures in the the Workspace
You could use this recursive function to display the variable stored in the Nth level of a structure. This is a starting templat...

oltre 7 anni fa | 1

Risposto
please, I have 5 axes in matlab gui and when i plot in axes1 he can't grid. i used grid or grid on after plot but anything in result . my script :
Instead of doing a generic |grid on| on the current axes, specify the axes. grid(handles.axes1, 'on') grid(handles.axes2...

oltre 7 anni fa | 0

| accettato

Risposto
fastaread fails when the header contains a comma
Try this one: |readFasta.m| (attached). Had to create another fasta reader due to the issues you're describing when using fastar...

oltre 7 anni fa | 1

Risposto
A question about moving dot. please help.
Not sure if it's an assignment, but here are more hints to achieve that: # Use |zeros(M, N)| to make a zero image of size MxN...

oltre 7 anni fa | 0

Risposto
Can I run unit tests in the MCR?
Instead of using the Application Compiler, use |mcc|. It'll give you a command window that opens up with the GUI. But the downsi...

oltre 7 anni fa | 0

Risposto
Use Compiler to Deploy Code on Remote Unix Machine
To compile the code, use |mcc| in MATLAB. It'll include your fcn.m file IF that file is in the MATLAB path. >> mcc -m main.m...

quasi 8 anni fa | 0

| accettato

Risposto
I'm getting webcam error in the following code, kindly hep me figure out the bug in code?
Without the error message, can't pinpoint the exact issues. But here are some guidelines and other issues. Check to make sure...

quasi 8 anni fa | 0

Risposto
how to save a plot without Margin of figure?
This might help: <https://www.mathworks.com/help/matlab/creating_plots/save-figure-with-minimal-white-space.html> Modify the...

quasi 8 anni fa | 4

Risposto
How to repeat array with
A = 1:4; E = [A(1) repelem(A(2:end), 2) A(1)]; E = 1 2 2 3 3 4 4 1

quasi 8 anni fa | 0

| accettato

Risposto
Running Code on HPC systems with differnent licenses and operating systems
The OS and the matlab runtime library version must match between the computer compiling your code and the computer running the c...

quasi 8 anni fa | 0

| accettato

Risposto
hi every body.my question is how can i change size of plot window in Matlab. like this picture. i want change the black window size as big as blue window. i want reduce plot window border.
plot(1:100, sin(1:100)) title('basic plot'); xlabel('x axis'); ylabel('y axis'); set(gca, 'units', 'normalized...

quasi 8 anni fa | 1

| accettato

Carica altro