回答済み
Comparision double values 135 with 135.0000
" A comparision with a simple if-statement and the == operator does not succeed." Yes, it does succeed: their values are differ...

約2ヶ月 前 | 0

| 採用済み

回答済み
Is it possible to fprintf/sprintf each row of elements in a vector using loop?
I would not use a loop: N = ["Earth"; "Venus"; "Mars"]; V = ["1.0000"; "0.8975"; "0.3915"]; fprintf('%s %s Gravity\n', [V(:),...

約2ヶ月 前 | 2

| 採用済み

回答済み
How can I import a file.txt and extract data?
opt = {'CollectOutput',true}; [fid,msg] = fopen('prova2.txt'); assert(fid>=3,'%s',msg) hdr = fgetl(fid); out = textscan(fid,...

約2ヶ月 前 | 1

| 採用済み

回答済み
Find values that are greater than a specific number in a table
nnz(Lake>=20)

約2ヶ月 前 | 0

| 採用済み

回答済み
Directly perform a multiplication on certain variables in a table
T = cell2table({'a',1,2;'b',3,4;'a',5,6},'VariableNames',{'x','y','z'}) idx = strcmp(T.x,'b'); T{idx,{'y','z'}} = T{idx,{'y','...

約2ヶ月 前 | 0

| 採用済み

回答済み
Recording vectors in for loop, when the loop is running in a range starting with negative numbers
Data are not indices, do not mix them up. V = -nmax:1:nmax; % data!!!! for k = 1:numel(V) % indices!!!!! n = V(k); % data...

約2ヶ月 前 | 0

| 採用済み

回答済み
How can I ask Matlab to adjust a parameter in an equation until the answer becomes equal with a predetermined input value?
Use FZERO: https://www.mathworks.com/help/matlab/ref/fzero.html Define a simple anonymous function with one input which calcula...

約2ヶ月 前 | 1

| 採用済み

回答済み
Conditions else if - efficiency advice
inp = '003'; % S group subS = {'001','002','003'}; aS = {'R','O','O'}; % T group subT = {'01','02','03'}; aT = {'O','O','R...

約2ヶ月 前 | 0

| 採用済み

回答済み
Calculate this matrix in a more general and shorter way
x = rand(100,1); w = pi; m = (1:5).*w.*x; m = [ones(100,1),reshape([cos(m);sin(m)],100,[])]; for comparison: P = [ones(size...

約2ヶ月 前 | 1

回答済み
Undefined variable in workspace problem
"where measurementValue is an n x 1 double array already loaded in my workspace." I guess you mean that it is loaded into the b...

約2ヶ月 前 | 0

回答済み
How to call a value from the command window to the editor window
Ugh, P-Files. You could try using EVALC: https://www.mathworks.com/help/matlab/ref/evalc.html and then parsing the string that...

約2ヶ月 前 | 1

回答済み
Getting error that output argument is not assigned during function when it is?
When direc is empty then ccmp is not defined (exactly as the error message states). This error is easy to demonstrate (showing ...

約2ヶ月 前 | 0

回答済み
@ Symbol in function handles as an input variable to another function
"if i were to remove the @ sign it would tell me that i am missing input arguments..." Because in that case you are just callin...

約2ヶ月 前 | 0

| 採用済み

回答済み
strcmp function using wildcards
T = cell2table({'A','XXX';'B','G22';'C','G13';'D','G1234';'E','YYY';'F','G01'}) idx = ~cellfun(@isempty,regexp(T.Var2,'^G\d\d$'...

約2ヶ月 前 | 1

| 採用済み

回答済み
How to read hh:mm:ss.sss time format from a file that has time and other data
Because you did not upload a sample file I had to create my own (attached). T = readtable('test.txt') T.Var1

約2ヶ月 前 | 0

回答済み
Find the different elements in a cell array
Where out is your cell array: fnh = @(v) any(v(:)==1)&&any(v(:)==2); idx = cellfun(fnh,out)

約2ヶ月 前 | 0

| 採用済み

回答済み
I want to arrange a 1st column of a matrix in descending order an the elements in the row is going to arrange itself according to change of the row of first vector
The simple MATLAB approach: A = [3,2;1,4;2,6] B = sortrows(A,-1)

約2ヶ月 前 | 0

| 採用済み

回答済み
includeSubFolders name value pair argument
imageDatastore(imdir, "IncludeSubfolders",true, "LabelSource","foldernames"); % ^^^^ yo...

約2ヶ月 前 | 0

| 採用済み

回答済み
when using intersect function i need all rows of B and matching rows of A. how can i do it?
T1 = array2table([2451,10;2554,5;5419,2],'VariableNames',{'A','id'}) T2 = array2table([2451,15;2554,7;5419,5;8542,9],'VariableN...

約2ヶ月 前 | 0

| 採用済み

回答済み
Subtracting in a structure
You can do all of them at once using some comma-separated lists: S(1).F = 6; S(2).F = 10; S(3).F = 12; S(4).F = 16; S(5).F ...

約2ヶ月 前 | 0

回答済み
Index table with cell array
Where T is your table and C is your cell array: idx = ismember(T.NameOfVariable, C) out = T(idx,:)

2ヶ月 前 | 0

| 採用済み

回答済み
Paste array a into array c based on the locations in array b
This is robust also when there is no overlap: a = [1,2,3,4,5,6]; b = [1,5,8,14,19,23]; d = diff(b); d(end) = d(end)+1; % inc...

2ヶ月 前 | 0

| 採用済み

回答済み
How to exclude specific results from dir
C = {'A1b1';'A1b2';'A1b1_test'}; cellfun(@mkdir,C) S = dir('./*'); S.name S(ismember({S.name},{'.','..'})) = []; S(endsWith...

2ヶ月 前 | 0

回答済み
I am getting a Error using alpha (line 68) Wrong number of arguments and was wondering if anyone could help me out because i am not sure what its saying.
% alpha in degree <<<<<< This needs to be a comment, not code. range=0:15:360; Y=sind(range); Table=[range;Y]'; disp('HW #6 ...

2ヶ月 前 | 0

回答済み
How to get an specific element from an output vector of a function handle?
You could define a simple wrapper function, e.g.: f = @(x) [x+1; x^2; 2*x]; g = @(a,x)a(x); g(f(1),2)

2ヶ月 前 | 1

| 採用済み

回答済み
Error using datenum (line 201) DATENUM failed.
Do not use outdated, discouraged, deprecated DATENUM (or for that matter DATEVEC or DATESTR). Import your data using READTABLE,...

2ヶ月 前 | 1

回答済み
Trying to write a function using @
g = @(x) sin(x)/x; % ^ ^ you forgot these g(1) g(pi) See: https://www.mathworks.com/help/matlab/matlab_prog/anonymous-fun...

2ヶ月 前 | 2

| 採用済み

回答済み
The assignment cannot be performed because the size of the left side is 1×1 and the size of the right side is 0×0.
"But I do not know where is wrong" The problem is caused by using GLOBAL variables instead of parameterizing the function prope...

2ヶ月 前 | 0

| 採用済み

回答済み
how do I know which toolboxes are installed?
"...an easy way to see which toolboxes are already installed into a windows workstation" " We would like to get this informatio...

2ヶ月 前 | 0

| 採用済み

回答済み
Getting an error For colon operator with char operands, first and last operands must be char.
This line j=('Input number of crossings =') should be j = input('number of crossings =')

2ヶ月 前 | 0

もっと読み込む