답변 있음
Saving figures in a for loop
You're saving 31 graphs to the same file name, 'Day_31.png' due to wrong use of iterator |k|. k = 31; for l = 1:k ...

7년 초과 전 | 1

| 수락됨

답변 있음
pdist2 - bottleneck is in argument parsing
To bypass the overhead, you could make your own MEX file for pdist2. Or, use |pdist2mex| directly, but then you'll have to find ...

7년 초과 전 | 0

답변 있음
Import/export a sequence of files
% for i = fileNum <<<< this is wrong. you get a vector of 0:45:360 for i = 1:length(filenum) fileName = sprintf('%...

7년 초과 전 | 0

| 수락됨

답변 있음
One vector split into zeros and ones
Alternatively, you could use |repelem| that'll be ~2x faster x = repelem([0 1], n/2)

7년 초과 전 | 2

| 수락됨

답변 있음
Making a small app in matlab
There's a good tutorial that explains where to add the callback functions. Run the following in your matlab command window. ...

7년 초과 전 | 0

| 수락됨

답변 있음
one problem about ismember function
This isn't an issue with |ismember| but with floating point math in general. Computers can't always add and subtract floating po...

7년 초과 전 | 0

| 수락됨

답변 있음
Alternatives to using eval/evalc for running a file?
Can we see the script? It should be able to be turned into a function instead. If you want the script to use the current variabl...

7년 초과 전 | 2

답변 있음
Plotting to multiple GUI axes simultaneously using a for loop
x = zeros(4, 101); %Preallocation is much faster Px = gObjects(1, 4); for c = 1:4 %Initilize all your plots, for 4 pins...

7년 초과 전 | 0

| 수락됨

답변 있음
Find the source of output in Command window
You probably have to write a custom script to search all your code for the semicolon error. See this Q&A which provides a starti...

7년 초과 전 | 0

답변 있음
Creating a Combination of Multiple Arrays
combvec(resulta', resultb')'

7년 초과 전 | 0

| 수락됨

답변 있음
replace multiple characters in a string with different characters
Are you sure you don't want to use |strrep|? strrep(strrep(line, 'r', '!'), 'u', '%') I like to avoid the |regexp| funct...

7년 초과 전 | 6

| 수락됨

답변 있음
Read/Write large CSV file
Instead of saving as csv, perhaps saving it as a binary file would be better for transporting data - unless, a human is going to...

7년 초과 전 | 0

| 수락됨

답변 있음
Internal function time increases with number of workers
Interesting. It does seem the function time is increasing with number of workers, BUT, the total time to run the parfor loop doe...

7년 초과 전 | 0

답변 있음
How to use MATLAB coder when .m file calls a MEX file?
_Of course I can use my non-converted function interp() instead of interp_mex(). When I use MATLAB coder to convert restr(), doe...

7년 초과 전 | 1

| 수락됨

답변 있음
How to display error
This Q&A might help: <https://www.mathworks.com/matlabcentral/answers/93287-is-there-a-way-to-debug-a-matlab-compiler-4-0-r14...

7년 초과 전 | 0

| 수락됨

답변 있음
Axes error in GUI
Geoff's answer will probably resolve your initial error, but you'll probably run into issues at the same place. Note that Axes c...

7년 초과 전 | 1

| 수락됨

답변 있음
How to produce a series of strings?
STR = strings(10, 10); for r = 1:10 for c = 1:10 STR(r, c) = string(char(('A'+r-1))) + (c-1); end ...

7년 초과 전 | 0

답변 있음
Matlab Compiler: Difference between the -a and -I option?
Hm, that explanation is indeed too short be certain. Here's how I read the definitions: the -a option will absolutely add f...

7년 초과 전 | 0

답변 있음
How to merge two images one over another?
I don't think you can go any faster at this point, unless zoom_image is a |double|. If so, then you can do zoom_image = zoo...

7년 초과 전 | 0

| 수락됨

답변 있음
Is there a simpler way to find the index of the first non NaN value in a vector?
X= [NaN NaN 1 2 3 4 5]; first_non_NaN_index_of_X = find(~isnan(X), 1);

7년 초과 전 | 3

| 수락됨

답변 있음
what is the function that the same as perms however can used n more than 10?
I think you need to make your own function of perms, but one that only returns 1 of many permutations at a time. When you past n...

7년 초과 전 | 1

| 수락됨

답변 있음
If Else Statements With Conditions
Did you want "OR" (||) or "AND" (&&)? if a+7+b <= index || index <= c %If you want OR, here it is. If you want AND, use &...

7년 초과 전 | 0

| 수락됨

답변 있음
how to read specific rows in multiple text files and store them into an matrix?
Since each txt file has a single column of numbers, you could use |fscanf|: FileNames = dir(fullfile(pwd, '**\C1*txt')); ...

7년 초과 전 | 1

답변 있음
How can I run 2 tasks in parallel?
You could use two |timer| objects, one for updating your |s| vector, and another for extracting the |s| vector and processing th...

7년 초과 전 | 1

| 수락됨

답변 있음
Use Matlab MCR without installing it (due to IT restrictions)
NEW POTENTIAL ANSWER Take a look here, section " *Install the MATLAB Runtime without Administrator Rights* " <https://www.ma...

7년 초과 전 | 0

| 수락됨

답변 있음
How can I write this fprintf description to include multiple vectors?
|mat2str| will help you write a matrix as a string. a = [10 7 -2]; b = [-4 6 -6]; z = a+b; k = a-b; x = dot...

7년 초과 전 | 0

답변 있음
Calling Variables from the Workspace
Go back to your variable creation, and change all your variable creation to Cap{#}. Example: Cap1 = [ 1 2 3 4 5] ==...

7년 초과 전 | 0

| 수락됨

답변 있음
Code execution in GUI
You could use a |timer| object to run the plots in the background until it receives a stop signal. See the example code and fig ...

7년 초과 전 | 2

| 수락됨

답변 있음
Functions vs scripts: speed
Glad you're thinking about coding practice and optimization. Version B is worse in terms of time, debugging, and coding prac...

7년 초과 전 | 3

| 수락됨

답변 있음
Is there a way to preallocate and efficiently shift entries of a growing list that needs to be kept sorted?
Try this: It takes advantage of java to achieve what you want to do. Growing unique lists in sorted order requires some tricks, ...

7년 초과 전 | 0

더 보기