Community Profile # Rik

Last seen: Today 2017 이후 활성

E-mails with feedback/questions about FEX submissions are welcomed. In general I will post e-mails about Answers on the related page, unless there is good cause not to do so.

#### Statistics

All
• • • • • • • • • • • • 배지보기

#### Content Feed

보기 기준

답변 있음
How to increase the efficiency of this MATLAB program by using vectorization techniques
Arrayfun will only hide the loop, so it will never be faster than a plain for loop. What you need to do is change your function...

약 17시간 전 | 0

| 수락됨

답변 있음
c++ programming.
You forgot two things: This is a Matlab forum and nothing in your question is related to Matlab Every line should end with a s...

약 18시간 전 | 0

답변 있음
char array to cell array convert?
If you want to round your data, just use round: T = {[5.8882656], [0.01232356], [0.02556545],[0.035659595]}; T = cell2mat(T); ...

약 19시간 전 | 0

| 수락됨

답변 있음
curve fit a custom polynomial
You have two options: rewrite your equation to be a pure quadratic and use polyfit, or use a function like fit or fminsearch on ...

약 23시간 전 | 1

답변 있음
Update elements in matrix with condition
N = size(P,1); for k = 1:1:N if P(k,5) == 0 P(k,3) = P(k,1) + P(k,3); end end Similar code will allow y...

1일 전 | 0

답변 있음
how to convert 1x2 double into two 1x1
It looks like this is what you want: x=Time_msg_match(61649); x=x{1};

5일 전 | 0

답변 있음
Is the formula given the same as the code?
Since the exponents range from -1 to -7, that means you will need 7 different values for t. One of the ways to achieve that is i...

6일 전 | 0

| 수락됨

답변 있음
I have a code but it keep saying "invalid expression. when calling a function or indexing a variable, use parentheses. otherwise check for mismatched delimiters.
The reason is these two lines: xx1=(0,8.*pi,1000) x3=(-4,4) Did you maybe forget linspace? Anyway, this isn't valid Matlab s...

7일 전 | 0

제출됨

regexp_outkeys
Regexp with outkeys in old releases

7일 전 | 다운로드 수: 2 |

답변 있음
why \pi don't work??
Why did you expect it to? This isn't LaTeX. If you want the pi symbol in a character vector that is possible: char(960) Or yo...

8일 전 | 0

답변 있음
arrays have incompatible sizes for this operation help me PLZ
I have removed all the plotting code and included calls to size to determine the sizes of all the variables involved. data_size...

10일 전 | 0

답변 있음
How can I load .mat files?
Or: matfilenames={'Datasets/a.mat','Datasets/b.mat','Datasets/c.mat'}; for k = 1:3 S=load(matfilename{k}); fields=fi...

10일 전 | 1

| 수락됨

답변 있음
How to fix "Error using == Arrays have incompatible sizes for this operation." in this code?
Let's have a look at the line that results in an error: n1=(sum(x.*y)-length(d)*mean(x)*mean(y))/(sum(x.^2)-length(d)*(mean(x)*...

10일 전 | 0

답변 있음
The Problem with clc; clear; close all; ?
My main point is that people will get into the habit of using this, and will also use it in functions. Clear is almost never ...

11일 전 | 0

| 수락됨

답변 있음
Stop using suggested word on right arrow
I just checked for you: If you go to the preferences (in the 'Home' tab), you can disable the automatic completions in the MATL...

12일 전 | 1

답변 있음
Unable to use a value of type 'cell' as an index
You need to unwind the call to see what's going on. When you create r_4, you have set UniformOutput to false. That means it i...

12일 전 | 1

| 수락됨

답변 있음
Extracting every row from a matrix using a for loop
This might not be optimal, depending on what you want to do, but the size function is here to help: data=rand(23999,31) for ro...

13일 전 | 0

답변 있음
Loop in a string array and changing string
Why didn't you mention this is homework? (I have seen this exact situation from another user this week, so barring evidence to t...

13일 전 | 0

| 수락됨

답변 있음
finding data from unique id in two tables
You can use the ismember function.

13일 전 | 1

| 수락됨

답변 있음
Matrix-vector operations without loops
You can use permute to reshape the second array and use the implicit expansion to do the multiplication in one go. Then sum over...

14일 전 | 1

답변 있음
There is an apparent error in line 4, and this code only ran once
t = [36, 65, 100, 160]; c = [0.145, 0.120, 0.100, 0.080]; t2 = (20:10:160); c2 = b*exp(t2*m); As you can see, you didn't def...

15일 전 | 0

답변 있음
Inside of a for loop. How to call another script lets say (IK.m) as Ik sub every time the loop goes to a new point?
I don't see how exactly you would end up with 6 values for each point, but if you convert your script to a function, that will m...

15일 전 | 1

| 수락됨

답변 있음
save data all of in loop
No loop required: num=xlsread('ENVISAT.ex.xlsx'); num=num(~isnan(num)); num=nonzeros(num); lon=num(1:2:end); lat=num(2:...

19일 전 | 0

| 수락됨

답변 있음
Including external file is making workspace messy
Let me expand on the suggestion of @Mathieu NOE: Use functions, not scripts. Each function should have documentation explaining...

20일 전 | 1

| 수락됨

답변 있음
Create matrix using the array as index
You don't even need a loop: a=[2 2 1 0 3]; ind=a+1; A=zeros(max(ind),numel(ind)); ind=sub2ind(size(A),ind,1:numel(ind)); ...

20일 전 | 0

| 수락됨

답변 있음
deleting separate zeros from vector
It took a bit of thinking, but here is a oneliner: A = [ 0 0 1 0 0 0 1 0 1 0 0 1 5 9 8 2 0 3 0 1 0 0 0 ]; ...

22일 전 | 0

| 수락됨

답변 있음
How can I interrupt a for or while loop by pressing a button 2?
You can tell Matlab to process callbacks with the drawnow function. If you put a call to drawnow just before you reload the val...

22일 전 | 0

| 수락됨

답변 있음
Input the same value into a cell array that each cell contains different fits?
I don't think there is a way to actually avoid a loop. You can avoid a double loop like this: results=zeros(size(CellWithFitObj...

22일 전 | 0

답변 있음
Compare two vectors in matlab n*m
You mean like this? A=[1 2 3 4 5 6 7 8 9 10]; B=4; result=zeros(size(A));%pre-allocate L= A<B ;result(L)=1; L= A==B;resul...

23일 전 | 0

| 수락됨